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

空扰寡人 提交于 2019-11-28 21:06:30

问题


I'm trying to connect to machine one with ssh and then connect to another machine two with ssh. But get this error:

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

stdin: is not a tty

回答1:


When logging into a shell, the remote host assumes that the connection is done by a human user. Therefore, it is reasonable to expect that they have control over the standard in on the client. That is to say, the user is giving input on a terminal through the keyboard. If the remote host detects that the user is not human (because the input is not a terminal - tty, but another process), it may warn the user about this unexpected condition.


A demonstration of the discussed misbehavior and how to avoid it (man ssh and look for -t for a more thorough explanation).

$ 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

...and the error:

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

You may want to make a tunnel instead:

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

Then, on a different terminal:

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

Use IP addresses such as 192.168.0.11 if DNS aliases are not configured on the remote end.



来源:https://stackoverflow.com/questions/12480284/ssh-error-when-executing-a-remote-command-stdin-is-not-a-tty

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!