##安装vsftp
yum -y install vsftpd
##添加ftp防火墙规则
/sbin/iptables -I INPUT -p tcp –dport 21 -j ACCEPT/etc/rc.d/init.d/iptables save/etc/init.d/iptables restart
##增加用户test,并制定test用户的主目录为/home/test
useradd -d /home/test test
##为test设置密码,运行后输入两次相同密码
passwd test
##限定用户test不能登陆系统,只能ftp
usermod -s /sbin/nologin test
##更改用户test的主目录为/test
usermod -d /test test
##限制用户只能访问/home/test,不能访问其他路径
修改/etc/vsftpd/vsftpd.conf如下:
chroot_local_user=YESchroot_list_enable=YES# (default follows)chroot_list_file=/etc/vsftpd/user_list
##重启
/etc/init.d/vsftpd restart