1. 安装 vsftpd
#sudo apt-get install vsftpd
2. 重启
#sudo service vsftpd restart
3. 新建"/home/uftp"目录作为用户主目录
#sudo mkdir /home/uftp
4. 新建用户uftp并设置密码
#sudo useradd -d /home/uftp -s /bin/bash uftp
5. 配置
/etc/vsftpd.conf文件
userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/allowed_users
seccomp_sandbox=NO
local_enable=YES
/etc/allowed_users文件
加入用户uftp
/etc/ftpusers文件
为不可访问的用户,确保uftp没在列表
6. 问题
a. 如何使用户a可以访问匿名目录
和ftp配置默认配置无关,只需匿名目录权限开放即可
b.如何使用户a只能访问自己的home目录
1. uncommend:chroot_list_file=/etc/vsftpd/chroot_list (/etc/vsftpd/vsftpd.conf)
2. 添加用户a到/etc/vsftpd/chroot_list
//
注1:
以上为ubuntu,
如果centos,好像只需确认/etc/allowed_users文件文件,其他默认ok。
注2:
注意用户根目录访问权限的设置 如uftp目录
注3:
匿名无密码访问需保证:anonymous_enable=YES
默认路径:/var/ftp
c. 更新密码后,如果不重启ftp服务,windows 访问会有以下错误(restart after updating password)
"Windows cannot access this folder. Make sure you have typed the file name correctly and that you have permission to access the folder."