In my case, forcing pty distribution on the external ssh of a two-level ssh call resolved the issue.
More details:
When you provide a command to start ssh (for example, ssh some_server "do_some_command"), then ssh assumes that you will not need an interactive session and it will not allocate pty, because it sends the job "do_some_command" that you set this to.
However, everything becomes interesting if you have two ssh levels (for example, let's say you want ssh to the “gateway” machine first, and from there you run ssh in the internal machine and run some “internal command”).
The fact is that with a two-layer ssh'ing job from the point of view of external ssh, you request that external ssh execute a non-interactive command, so external ssh does not allocate tty.
If the command that you run in internal ssh should be interactive, it will probably want to request tty attributes, and it (rightly) will tell you that it does not run on tty.
The solution in my case was to force external ssh to highlight pty using the -t argument. So it looked like this:
ssh -t <gateway_machine> "ssh <inner_machine> \" <inner_interactive_command> \ ""
Greetings to system administrators there
source share