我有一个 Debian Wheezy 服务器,当他们通过 openssh 服务器登录时,我想在其中 chroot 某些用户。但是,我遇到了一个奇怪的错误:出于测试目的,我只是添加了
ChrootDirectory /data/
Run Code Online (Sandbox Code Playgroud)
到我的 sshd_config 文件(并重新启动服务器)
当我尝试通过 putty 登录时,窗口只是关闭而没有错误消息。当我尝试将 openssh-client 从服务器用于自身时,我收到此错误:
ssh testuser@localhost
testuser@localhost's password:
Last login: ....
/bin/bash: No such file or directory
Connection to localhost closed
Run Code Online (Sandbox Code Playgroud)
/data/ 目录归 root:root 所有,有 755 个权限。如果我尝试添加具有相同权限的 /data/testuser 目录,则会发生相同的错误。
在 auth.log 中没有任何尝试的痕迹。
如果我从 sshd_config 中删除 chroot 行并重新启动服务器,我可以通过 putty 和 openssh-client 正常登录。
为什么我收到这个错误?我不明白。