I'm trying to connect to machine one with ssh and then connect to another machine two with ssh. But get this error:
ssh [email protected] 'ssh [email protected]' stdin: is not a tty
When you run ssh without a command just to login, a pseudo tty is automatically allocated. But if you specify a command to execute on the ssh command line, by default, ssh does not allocate a pseudo tty. You need to force it to allocate one if you want to run commands such as top or screen.
/dev/tty is the controlling terminal for the current process. STDIN is the current input. If you redirect, e.g., perl script.pl <myfile.txt.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With