SSH 失败,/bin/bash:没有那个文件或目录

Mat*_*yan 1 ssh user-management chroot

我有一个被监禁的用户。

sshd_config:

Subsystem sftp internal-sftp

Match user matt
     ChrootDirectory %h
     X11Forwarding no
     AllowTcpForwarding no
Run Code Online (Sandbox Code Playgroud)

密码:

matt:x:1001:5006:Matt Ryan,,,:/home/matt:/home/matt/bin/bash
Run Code Online (Sandbox Code Playgroud)

这对 sftp 非常有效。用户仅限于他的主文件夹,以及那里的任何挂载。

但是,我也想给这个使用 shell 访问权限。这是他们尝试登录时发生的情况:

$ ssh matt@server.com
Linux devnode 2.6.38-linode31 #1 SMP Mon Mar 21 21:22:33 UTC 2011 i686 GNU/Linux
Ubuntu 10.04.2 LTS

Welcome to Ubuntu!
 * Documentation:  https://help.ubuntu.com/
Last login: Thu Mar 31 13:04:29 2011 from abc.nyc.res.rr.com
/home/matt/bin/bash: No such file or directory
Connection to server.com closed.
Run Code Online (Sandbox Code Playgroud)

通过 fstab,bin 文件夹被挂载到主目录并存在。

为什么我会收到这个错误..我该如何解决这个问题?

谢谢您的帮助!

gee*_*aur 5

当你chroot,命名目录变成/. 内部正确的外壳路径chroot是 then /bin/bash,而不是/home/matt/bin/bash.

您还需要确保chroot系统内部有足够的其他东西来工作。你可以测试一下,sudo chroot /home/matt /bin/bash看看哪些有效,哪些无效;起码,你可能会想一个虚拟的/etc,一个bind安装的/proc,而很多/libchroot