vsftpd启动报错:vsftpd:500 OOPS: bad bool value in config file for: anonymous_enable

1: 安装vsftpd

#aptitude install vsftpd


2:配置 vsftpd

#vim /etc/vsftpd.conf

  1. # 服务器以standalong模式运行,这样可以进行下面的控制  
  2. listen=YES  
  3. # 接受匿名用户  
  4. anonymous_enable=YES  
  5. # 匿名用户login时不询问口令  
  6. no_anon_password=YES  
  7. # 接受本地用户  
  8. local_enable=YES  
  9. # 可以上传(全局控制).若想要匿名用户也可上传则需要设置anon_upload_enable=YES,   
  10. # 若想要匿名用户可以建立目录则需要设置anon_mkdir_write_enable=YES.这里禁止匿名用户上传,所以不设置这两项  
  11. write_enable=YES  
  12. # 本地用户上传文件的umask  
  13. local_umask=022  
  14. # 如果设为YES,匿名登入者会被允许上传目录的权限,当然,匿名使用者必须要有对上  
  15. # 层目录的写入权。  
  16. anon_upload_enable=YES  
  17. # 定义匿名登入的使用者名称。默认值为ftp  
  18. ftp_username=ftp  
  19. # 如果设为YES,匿名登入者会被允许新增目录,当然,匿名使用者必须要有对上层目录  
  20. # 的写入权。  
  21. anon_mkdir_write_enable=YES  
  22. # 为YES则进入目录时显示此目录下由message_file选项指定的文本文件  
  23. # (,默认为.message)的内容  
  24. dirmessage_enable=YES  
  25. # 本地用户login后所在目录,若没有设置此项,则本地用户login后将在他的home目录  
  26. # (/etc/passwd的第六个字段)中.匿名用户的对应选项是anon_root  
  27. # local_root=/home  
  28. anon_root=/home/ftp/  
  29. # 使用上传/下载日志,日志文件默认为/var/log/vsftpd.log,可以通过xferlog_file  
  30. # 选项修改  
  31. xferlog_enable=YES  
  32. # Make sure PORT transfer connections originate from port 20 (ftp-data).  
  33. connect_from_port_20=YES  
  34. # 日志使用标准xferlog格式  
  35. xferlog_std_format=YES  
  36. # You may change the default value for timing out a data connection.  
  37. data_connection_timeout=120  
  38. # 关闭本地用户chroot()  
  39. chroot_local_user=NO  
  40. # 设置为yes则下面的控制有效。  
  41. # 开启要设置chroot()用户项.  
  42. chroot_list_enable=YES  
  43. # (default follows)  
  44. # 指定要设置chroot()的特定用户文件  
  45. chroot_list_file=/etc/vsftpd.chroot_list  
  46. # 若设置为YES则记录在userlist_file选项指定文件(默认是/etc/vsftpd.user_list)  
  47. # 中的用户无法login,并且将检察下面的userlist_deny选项  
  48. userlist_enable=YES  
  49. # 若为NO,则仅接受记录在userlist_file选项指定文件(默认是/etc/vsftpd.user_list)  
  50. # 中的用户的login请求.若为YES则不接受这些用户的请求.  
  51. userlist_deny=NO  
  52. # 注意!!!vsftpd还要检察/etc/vsftpd.ftpusers文件,记录在这个文件中的用户将  
  53. # 无法login!!  
  54. # 匿名用户的传输比率(b/s)  
  55. anon_max_rate=512000  
  56. # 本地用户的传输比率(b/s)  
  57. local_max_rate=1024000  
  58. # 可接受的最大client数目  
  59. max_clients=100  
  60. # 每个ip的最大client数目  
  61. max_per_ip=5  
  62. # This option should be the name of a directory which is empty.  Also, the  
  63. # directory should not be writable by the ftp user. This directory is used  
  64. # as a secure chroot() jail at times vsftpd does not require filesystem access.  
  65. secure_chroot_dir=/var/run/vsftpd  
  66. # This string is the name of the PAM service vsftpd will use.  
  67. pam_service_name=vsftpd  
  68.   
  69. tcp_wrappers=YES  
  70.   
  71. # This option specifies the location of the RSA certificate to use for SSL  
  72. # encrypted connections.  
  73. rsa_cert_file=/etc/ssl/certs/vsftpd.pem  
  74. # 每一个联机,都能以独立的process 来呈现.  
  75. setproctitle_enable=YES  
  76. # 若是启动,所有匿名上传数据的拥有者将被更换为chown_username当中所设定的使用  
  77. # 者。这样的选项对于安全及管理,是很有用的。  
  78. chown_uploads=YES  
  79. # 这里可以定义当匿名登入者上传档案时,该档案的拥有者将被置换的使用者名称。预  
  80. # 设值为root。  
  81. chown_username=root  


3: 增加用户名 用户组

#groupadd ftpuser

#mkdir /home/tom/

#useradd -g ftpuser tom

passwrd tom


4:修改权限

#vim /etc/passwd

最后面是权限

tom:x:1001:1001::/home/tom:

增加/bin/bash

tom:x:1001:1001::/home/tom:/bin/bash

更改文件所有者权限

#chown -v -R tom:ftpuser /home/tom/

#chmod -v -R 700 /home/tom/

共享给ftpuser组一个文件夹,做一个连接

#ln -v -s /home/ftpuser/ /home/tom/ftpuser

设置欢迎信息,在每个用户的文件夹中新建.message

编辑/etc/vsftpd.user_list 填写所有ftp的用户,包括匿名的anonymous

编辑/etc/vsftpd.chroot_list 填写不准进入上层目录的用户名

给/home/ftp/ 中允许匿名写的目录的修改权限,没有新建

保存后重启vsftpd

#/etc/init.d/vsftpd restart

chmod -v 777 /home/ftp/temp/

建立我们的根目录,并设置访问权限

[root@localhost ~]# mkdir /var/public_root
[root@localhost ~]# chown -R cent /var/public_root
[root@localhost ~]# chmod -R 755 /var/public_root

5. vsftpd的log默认在/var/log/vsftpd.log 

ftp的目录在/home/ftp


如果用户登录报错530 

那么检查下/etc/passwd 的shell,改为/sbin/ nologin

并且在 /etc/shell里面加入上面的地址 保存后重启vsftpd

要挂载非ftp的目录,比如其他的路径,使用mount --bind

比如要挂在/home/music 到/home/ftp/music  先mkdir /home/ftp/music

#mount --bind /home/music /home/ftp/music

即可

如果需要重启后自动mount,需要修改/etc/fstab

加入需要mount的 device name , mount point , filessystem, options

或者直接在/etc/rc.local 里面把mount 命令加入让它开机自动mount 

  1. mount --bind /home/media/ /home/ftpuser/media/  
  2. mount --bind /home/manual/ /home/ftpuser/manual/  
  3. mount --bind /home/tools/ /home/ftpuser/software/ 


----------------------------------------------------------------我是分割线-------------------------------------

1.

vsftpd启动报错:vsftpd:500 OOPS: bad bool value in config file for: anonymous_enable

  1. 原因:在配置中输入了不必要的空格。原来linux中也不允许有多余的空格哦。  
  2.   
  3. 解决办法:在编辑vi /etc/vsftpd.conf 时,:每行的值都不要有空格,否则启动时会出现错误,举个例子,假如我在listen=YES后多了个空格
2.500 OOPS: run two copies of vsftpd for IPv4 and IPv6

VSFTPD可以同时运行在IPv4和IPv6网络下,不过需要使用两个配置文件,将“listen=YES”和“listen_ipv6=YES”分别放在两个配置文件中,一个负责监听IPv4,一个负责监听IPv6,这样就不会冲突了。

经过测试,IPv4和IPv6确实都可以正常连接。

3.vsftpd/ftpusers与vsfptd/user-list文件配置

在/etc/目录下的vsftpd/ftpusers和vsftpd/user-list两个文件与主配置文件中的"userlist_enable"和"userlist_deny"选项有着密切联系。两个文件中,每个用户名需占用一行。

以下是默认情况下ftpusers文件的内容:

 
  
  1. # Users that are not allowed to login via ftp  
  2. root  
  3. bin  
  4. daemon  
  5. adm  
  6. lp  
  7. sync  
  8. shutdown  
  9. halt  
  10. mail  
  11. news  
  12. uucp  
  13. operator  
  14. games  
  15. nobody 

以下是默认情况下user_list文件的内容:

 
  
  1. # vsftpd userlist  
  2. # If userlist_deny=NO, only allow users in this file  
  3. # If userlist_deny=YES (default), never allow users in this file, and  
  4. # do not even prompt for a password.  
  5. # Note that the default vsftpd pam config also  checks /etc/vsftpd/ftpusers  
  6. # for users that are denied.  
  7. root  
  8. bin  
  9. daemon  
  10. adm  
  11. lp  
  12. sync  
  13. shutdown  
  14. halt  
  15. mail  
  16. news  
  17. uucp  
  18. operator  
  19. games  
  20. nobody
5.

vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法

这个问题发生在最新的这是由于下面的更新造成的:

  1. - Add stronger checks for the configuration error of running with a writeable root directory inside a chroot(). This may bite people who carelessly turned on chroot_local_user but such is life.  

从2.3.5之后,vsftpd增强了安全检查,如果用户被限定在了其主目录下,则该用户的主目录不能再具有写权限了!如果检查发现还有写权限,就会报该错误。

 要修复这个错误,可以用命令chmod a-w /home/user去除用户主目录的写权限,注意把目录替换成你自己的。或者你可以在vsftpd的配置文件中增加下列两项中的一项:


allow_writeable_chroot=YES


vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法

vsftpd:500 OOPS: vsftpd: refusing to run with writable root inside chroot ()错误的解决方法


猜你喜欢

转载自blog.csdn.net/shenwansan_gz/article/details/78616221