簡體   English   中英

執行遠程命令時出現SSH錯誤:“stdin:不是tty”

[英]SSH error when executing a remote command: “stdin: is not a tty”

我正在嘗試使用ssh連接到第一台機器,然后使用ssh連接到另一台機器。 但得到這個錯誤:

ssh user@computerone.com 'ssh otheruser@computertwo.com'

stdin: is not a tty

登錄到shell時,遠程主機假定連接是由人類用戶完成的。 因此,期望他們能夠控制客戶端上的標准是合理的。 也就是說,用戶通過鍵盤在終端上進行輸入。 如果遠程主機檢測到用戶不是人(因為輸入不是終端 - tty,而是另一個進程),它可能會警告用戶這種意外情況。


演示了所討論的不當行為以及如何避免它( man ssh並尋找-t以獲得更徹底的解釋)。

$ ssh -t genja.org 'ssh raptor.lan hostname\; uptime'
host: genja.lan 
raptor
 21:17:27 up 3 days, 15 min,  1 user,  load average: 0.00, 0.00, 0.00
Connection to genja.org closed.

$ ssh genja.org uptime 
host: genja.lan 
 21:17:43 up 12 days, 17:40,  1 user,  load average: 0.30, 0.08, 0.02

......和錯誤:

$ ssh  genja.org 'ssh raptor.lan hostname\; uptime'
host: genja.lan 
Permission denied (publickey,keyboard-interactive).

您可能想要制作隧道:

ssh -L 4444:raptor.lan:22 genja.org

然后,在另一個終端上:

ssh -p 4444 localhost will give you a conenction straight to "raptor.lan"

如果遠程端未配置DNS別名,請使用192.168.0.11等IP地址。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM