bash脚本ssh到一个盒子,让我一个python壳 [英] bash script to ssh into a box and get me to a python shell

查看:107
本文介绍了bash脚本ssh到一个盒子,让我一个python壳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个脚本,将让我直接到另一盒一个python外壳,这样我就不必先运行ssh和第二轮蟒蛇。

当我这样做的ssh主机蟒蛇它只是挂起 - 这是与事实蟒蛇是交互式的。 SSH主机名猫X工作正常。

有一些SSH选项,将会使这项工作?


解决方案

 的ssh -t用户@主机蟒蛇

-t标志强制ssh分配伪终端的连接。一般来说,如果SSH命令行,这将导致蟒蛇运行在非交互模式上给出一个命令就无法做到这一点。

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?

解决方案

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.

这篇关于bash脚本ssh到一个盒子,让我一个python壳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆