我一直在尝试在 debian 服务器中配置 sftp。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
,然后连接被断开。在 sshd_config 中注释ChrootDirectory
命令会建立连接,但会让用户松动。
我究竟做错了什么 ?
使用
ChrootDirectory
option insshd_config
需要对书面文本有一些基本的了解。这是来自手册页的快照
sshd_config(5)
:这是您的错误日志:
这意味着您需要确保满足引用中强调的部分:您
/
需要由 root 拥有并且w
只有所有者拥有 acl。