我一直在尝试在debian服务器中configurationsftp。 sshd_config:
Subsystem sftp internal-sftp UsePAM no Match User sftpUser ChrootDirectory /users/sftp/sftpUser ForceCommand internal-sftp AllowTcpForwarding no X11Forwarding no
目录:
drwxr-xr-x 3 root root 4096 Oct 20 10:59 users drwxr-xr-x 3 root root 4096 Oct 20 11:00 sftp drwxr-xr-x 2 root root 4096 Oct 20 11:00 sftpUser
cat /var/log/auth.log
Oct 20 10:58:22 w1 sshd[24634]: Accepted password for sftpUser from 201.156.103.213 port 34106 ssh2 Oct 20 10:58:22 w1 sshd[24636]: fatal: bad ownership or modes for chroot directory component "/"
sftpUser没有家, bin/false和用户组的成员。
在客户端,我得到着名的Write failed: Broken pipe断开的Write failed: Broken pipe ,然后连接被丢弃。 在sshd_config中注释ChrootDirectory命令会build立连接,但是会让用户松动。
我究竟做错了什么 ?
在sshd_config使用ChrootDirectory选项需要对书面文本有一些基本的了解。
这是sshd_config(5)手册页的快照:
ChrootDirectory
指定要validation后
chroot(2)的目录的path名。 path名的所有组件都必须是不能由任何其他用户或组写入的根拥有的目录。 在chroot之后,sshd(8)将工作目录更改为用户的主目录。
这是你的错误日志:
fatal: bad ownership or modes for chroot directory component "/"
这意味着您需要确保完成引用的强调部分:您的/需要由root拥有,并且只针对所有者。