当我们限定了用户不能跳出其主目录之后,使用该用户登录FTP时往往会遇到这个错误:

500 OOPS: vsftpd: refusing to run with writable root inside chroot ()

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

– 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

完整配置:

root@xxxx:~# cat /etc/vsftpd.conf | grep -v "#"
listen=YES

listen_port=9600
pasv_enable=YES
pasv_min_port=9601
pasv_max_port=9699
pasv_promiscuous=YES
ftpd_banner=Welcome to TCore Cloud FTP Service

listen_ipv6=NO
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
chroot_local_user=NO
allow_writeable_chroot=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
ssl_enable=NO

标签: vsftpd