chroot将用户关入一个目录

可能重复:
我怎样才能chroot SSH连接?

我想在Debian上使用chroot将一个特定的用户关进一个目录(这样他们可以sftp和ssh)。 我怎样才能做到这一点?

手册页说

Usage: chroot [OPTION] NEWROOT [COMMAND [ARG]...] or: chroot OPTION Run COMMAND with root directory set to NEWROOT. --userspec=USER:GROUP specify user and group (ID or name) to use --groups=G_LIST specify supplementary groups as g1,g2,..,gN --help display this help and exit --version output version information and exit 

我想监狱用户“智能”到/ home /服务器/智能,但是当我input: chroot --userspec=1001 /home/servers/smart ,它说chroot: failed to run command '/bin/bash': No such file or directory

我已经把我的大脑search出来了,我找不到内置的chroot命令的单个教程。

这基本上是重复的: 我怎样才能chroot SSH连接?

chroot不适用于每个用户 ,但每个进程 。 – 所以它必须由sshd或用户的loginshell调用/激活。

在较新的OpenSSH版本中,限制SFTPlogin非常简单。 对于交互式shelllogin来说,它总是更加困难,因为所有允许的程序必须在jail内部可访问。