本文采用CentOS 7(VMware虚拟机)做测试
1. useradd –d /opt/nginx/htmlftpman 增加用户ftpman并指定主目录为/opt/nginx/html
2. passwd ftpman 设定FTP用户密码
3. usermod -s /sbin/nologin ftpman 限定用户不能登录(Telnet)
4. 限制用户只能访问/opt/nginx/html,不能访问其他路径
5. 修改/etc/vsftpd/vsftpd.conf如下:
Anonymous_enable=NO //不允许匿名登录
chroot_list_enable=YES //限制访问自身目录
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
6. 改完配置文件,不要忘记重启vsFTPd服务器
7. systemctl restart vsftpd
8. 如果需要允许用户修改密码,但是又没有telnet登录系统的权限:
9. usermod -s /usr/bin/passwd test //用户telnet后将直接进入改密界面
10. vi /etc/ssh/sshd_config
11. 将Subsystem sftp /usr/libexec/openssh/sftp-server
改为Subsystem sftp internal-sftp
12. systemctl restart sshd.service