It seems that by default (i.e. without -t or -T ssh option), tty allocation is done only when one doesn't provide a command. If the user provides a command, no tty allocation occurs by default: ypig:~> ssh localhost echo \$TERM ypig:~> ssh -t localhost echo \$TERM xterm-debian Connection to localhost closed. This behavior is not documented in the ssh/sshd man pages. In the ssh man page, I can only see: If a pseudo-terminal has been allocated (normal login session), the user may use the escape characters noted below. but this is very ambiguous (what is a "normal login session"?). Also, I wonder whether there's a difference between "pseudo-tty" and "pseudo-terminal"; the man page should be consistent. The sshd man page has: command="command" Specifies that the command is executed whenever this key is used for authentication. The command supplied by the user (if any) is ignored. The command is run on a pty if the client requests a pty; otherwise it is run without a tty. [...] but this is just documentation about command="...".
Created attachment 2610 [details] Clarify pseudo-terminal behaviour. Here's the updated text: """ When the user's identity has been accepted by the server, the server either executes the given command as a non-interactive session, or if no command has been specified, logs into the machine and gives the user a normal shell as an interactive session. All communication with the remote command or shell will be automatically encrypted. If an interactive session is requested ssh by default will request a pseudo-terminal (pty) if the client has one, otherwise it will not request one. The flags -T and -t can be used to override this behaviour. If a pseudo-terminal has been allocated the user may use the escape characters noted below. """
I have just committed the man page change and it will be in the 6.9 release. Thanks for the report.
Close all resolved bugs after 7.3p1 release