FreeBSD Jail 和 SSH -/dev/tty : No such file or directory

标签 freebsd jail

当我尝试从 JAIL 内部通过 SSH 连接时,出现此错误:

# ssh test@test.com
...
debug1: read_passphrase: can not open / dev / tty: No such file or directory
Host key verification failed.

在 JAIL 之外一切正常。有什么想法吗?

重现步骤:

# jls
JID  IP Address      Hostname                      Path
1     10.10.3.1       demo.example.com             /jails/demo

# jexec 1 tcsh

(inside jail:)
# ssh test@test.com

最佳答案

你的 jail root 是否有一个通过 devfs 挂载的/dev 文件系统?现在看来还不行。

重要提示:您应该能够使用 devfs 规则来限制对受限进程可见的设备。特别是,访问原始磁盘设备节点是一个的想法。 jail(8) 联机帮助页在以下段落附近对此进行了描述:

It is important that only appropriate device nodes in devfs be exposed to a jail; access to disk devices in the jail may permit processes in the jail to bypass the jail sandboxing by modifying files outside of the jail. See devfs(8) for information on how to use devfs rules to limit access to entries in the per-jail devfs. A simple devfs ruleset for jails is available as ruleset #4 in /etc/defaults/devfs.rules.

您应该能够在 /jails/demo/dev 下安装 devfs 并通过以 root 身份运行以下命令来应用推荐的 jail 设备规则:

# mkdir /jails/demo/dev
# mount -t devfs devfs /jails/demo/dev
# devfs -m /jails/demo/dev rule -s 4 applyset

当然,你也可以在/etc/defaults/devfs.rules中编写自定义规则集,甚至是只适用于特定jail的特殊devfs规则集。

有关更多详细信息,另请参阅 jail(8)devfs(8)devfs.rules(5) 的联机帮助页。

关于FreeBSD Jail 和 SSH -/dev/tty : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3542176/

相关文章:

kernel - FreeBSD 从另一个系统调用发出一个系统调用

Unix和FreeBSD

makefile - FREEBSD: make install 未知修饰符 'u' 变量 ALL_OPTIONS 是递归的

sockets - 我如何在内核空间(freebsd)中监听一个 tcp 端口?

ssh - 限制 SSH - 没有命令的 bash

postgresql - FreeBSD: jail 无法设置 security.jail.sysvipc_allowed

c - 如何获取已死亡子进程的 PID 并在父进程中使用它?

linux - 创建一个 Chroot jail 并将所有系统文件复制到 jail 中

sockets - FreeBSD jail 和套接字

git - 保护 git 服务器