0

man ssh says:

-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.

https://explainshell.com/explain?cmd=ssh+-tt

Multiple -t options force tty allocation, even if ssh has no local tty.

What does that mean specifically? If there is no shell on the system, does ssh create its own? What must happen that -tt fails?

secf00tprint
  • 123
  • 5

1 Answers1

2

If you do this:

ssh -t user@server<<EOT
echo test
EOT

You'll get a message that states: Pseudo-terminal will not be allocated because stdin is not a terminal. In this case, stdin was feeding ssh, not your local shell/tty.

Using -tt will tell it to allocate regardless. This is one use-case, I'm sure there are other cases that can be applied to this, but stdin is one of the most obvious.


If there is no shell on the system, does ssh create its own?

No local tty for ssh is not suggesting that a local shell does not exist. The above example shows using stdin to stream into ssh.

What does that mean specifically?

It means it will force the tty allocation regardless of the local connection. See above example.

Rino Bino
  • 511
  • 5
  • 21