我有一个被监禁的用户。
sshd_config中:
Subsystem sftp internal-sftp Match user matt ChrootDirectory %h X11Forwarding no AllowTcpForwarding no
passwd文件:
matt:x:1001:5006:Matt Ryan,,,:/home/matt:/home/matt/bin/bash
这对于sftp是完美的。 用户被限制在他的主文件夹,无论有什么安装。
但是,我想也给这个使用shell访问。 这是他们尝试login时发生的情况:
$ ssh [email protected] 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.
通过fstab,bin文件夹被挂载到主目录并且存在。
为什么我得到这个错误..我该如何解决这个问题?
谢谢您的帮助!
当你chroot ,指定的目录变成/ 。 在chroot里面正确的shellpath是/bin/bash ,而不是/home/matt/bin/bash 。
您还需要确保在chroot有足够的其他内容供系统使用。 你可以用sudo chroot /home/matt /bin/bash ,看看有什么作用,什么不可以。 至less,你可能需要一个虚拟的/etc ,一个/proc的bind挂载,以及大量的/lib在chroot 。