Bash script in ssh in field and get me into python shell

I want to write a script that will lead me directly to the python shell on another field, so I do not need to start ssh and the second python run first.

When I do "ssh hostname python" it just hangs - this is because python is interactive. "ssh hostname cat x" works fine.

Is there an ssh option that will make this work?

+3
source share
3 answers
ssh -t user@host python 

The -t flag causes ssh to allocate a pseudo-terminal for the connection. Usually this will not be done if the command is given on the ssh command line, which causes python to start in non-interactive mode.

+10
source

actually figured it out, I needed to do ssh -t hostname python

+4
source

You need the -t option to force pseudo-tty

 ssh -t host python 
+4
source

Source: https://habr.com/ru/post/1302401/


All Articles