在CENTOS上执行
1 cp /usr/sbin/sshd /usr/sbin/sftpd
2 cp /etc/pam.d/sshd /etc/pam.d/sftpd
3 cp /etc/ssh/sshd_config /etc/ssh/sftpd_config
vi sftpd_config
Port 9091
Match User inscgb
ChrootDirectory /home/inscgb
ForceCommand internal-sftp
X11Forwarding no
AllowTcpForwarding no
PermitTTY no
#Match Group sftpgroup
目录要求,账号的根目录及以上目录都要属于root
[root@iZuf62ujq5zpxy5gzgntjsZ ~]# ls -ld /home/inscgb
drwxr-xr-x 4 root root 4096 Jun 29 16:00 /home/inscgb
[root@iZuf62ujq5zpxy5gzgntjsZ ~]# ls -ld /home/
drwxr-xr-x. 9 root root 4096 Jun 29 15:59 /home/
[root@iZuf62ujq5zpxy5gzgntjsZ ~]# ls -ld /home/inscgb/doc
drwxrwxrwx 2 root root 4096 Jun 29 16:00 /home/inscgb/doc
/usr/sbin/sftpd -f /etc/ssh/sftpd_config &