bash script to ssh into a box and get me to a pyth

2019-07-04 11:28发布

I want to write a script that will get me straight to a python shell on another box so that i don't have to first run ssh and second run python.

When I do "ssh hostname python" it just hangs - it's something to do with the fact that python is interactive. "ssh hostname cat x" works fine.

Is there some ssh option that will make this work?

3条回答
贼婆χ
2楼-- · 2019-07-04 11:38
ssh -t user@host python

The -t flag forces ssh to allocate a pseudo-terminal to the connection. Normally it won't do this if a command is given on the ssh command line, which results in python running in a non-interactive mode.

查看更多
Evening l夕情丶
3楼-- · 2019-07-04 11:54

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

查看更多
The star\"
4楼-- · 2019-07-04 12:01

You need the -t option to force the allocation of a pseudo-tty

ssh -t host python
查看更多
登录 后发表回答