2010-08-22 48 views
1

當我試圖通過SSH從監獄中連接我得到這個錯誤:FreeBSD的監獄和SSH - 的/ dev/tty的:沒有這樣的文件或目錄

# ssh [email protected] 
... 
debug1: read_passphrase: can not open/dev/tty: No such file or directory 
Host key verification failed. 

外JAIL everythng工作正常。有任何想法嗎?

重現步驟:

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

# jexec 1 tcsh 

(inside jail:) 
# ssh [email protected] 
+0

看到http://stackoverflow.com/questions/5087773/emacs-could-not-open-file-dev-tty 同樣的問題,但如何使其發揮作用。 – chadbag 2011-11-09 21:09:37

回答

6

貴監獄根已經通過devfs的一個填充/ dev文件系統掛載?看起來它現在不正確。

重要注意事項:您應該可以使用devfs規則來限制設備在監獄進程中可見。特別是,對原始磁盤設備節點的訪問是一個不好的想法。該監獄(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並通過運行作爲以下命令應用推薦的監獄設備規則:

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

當然,您也可以在/etc/defaults/devfs.rules中編寫自定義規則集,即使是隻適用於特定監獄的特殊devfs規則集。

詳情也看到了聯機幫助頁牢(8)的devfs(8),和devfs.rules(5)

1

如果您通過jail命令進入監獄,您也可能會遇到這種情況。如果你啓動監獄和SSH進入它,你應該有更好的運氣。

1

devfs文件系統可能沒有安裝在你的監獄裏。許多事情都會失敗,而不僅僅是ssh。

要automotically安裝正確過濾devfs的,最好的辦法是使用的rc.conf變量:

jail_enable=YES

jail_list="JAILNAME"

jail_devfs_enable=YES

jail_JAILNAME_rootdir='/jails/demo'

jail_JAILNAME_hostname="demo"

然後你就可以停止/使用「/etc/rc.d/jail開始演示停止」,電子

相關問題