4、设置用户口令 passwd ftpuser 5、编辑文件chroot_list: vi /etc/vsftpd/chroot_list 内容为ftp用户名,每个用户占一行,如:
peter
john
6、重新启动vsftpd service vsftpd restart
另外,如果觉得以后管理ftp用户名嫌麻烦,可以使用centos官方发布的脚本管理。地址如下:
http://wiki.centos.org/HowTos/Chroot_Vsftpd_with_non-system_users
出现的错误
1、500 OOPS: cannot change directory
解决方法:
出现该问题的原因其实是 SElinux 在作怪。我们可以先查看下系统中 SElinux 的状态。
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
通过查看 SElinux 配置文件可以得到结果,它的状态为 enforcing,并不是 disabled。出现这个错误是由于 SElinux 没有信任这个服务的原因。
解决该问题的方法如下:
1. 修改 selinux 的配置文件中的 SELINUX=enforcing 为 SELINUX= disabled (其实这样修改是不生效的,除非是重启系统才可以。)
2. 查看 ftp的状态 sestatus -b | grep ftp
在出现的结果中可以看到 ftp_home_dir off
3. tftpd_disable_trans off
之类。我们现在只要把其中之一设置为on就可以啦。
4. setsebool -P ftpd_disable_trans on 或者 setsebool -P ftp_home_dir on
5. 重启 vsftpd: /etc/init.d/vsftpd restart