tags:

views:

49

answers:

2

Hello,

I'd like to start an interactive SSH terminal from a Python script without using modules like pexpect or paramiko - I want to stick with what CentOS pre-installed Python provides me (to ease compatibility and deployment issues).

I can run commands fine using the subprocess module, but cannot get an interactive terminal. In Perl, I would just use backticks to achieve this, but am looking for the pythonic way of doing this.

Can someone point me in the right direction?

+1  A: 

I get an interactive terminal if I use os.system('ssh [...]')

leoluk
Does it work if you use Popen? From http://docs.python.org/library/subprocess.html I figured I shouldn't use os.system. I'm trying to make it work like this now, I'll check back in shortly.
gnucom
Using the instructions to convert os.system to Popen, I was able to make it work.
gnucom
A: 

You could use pexpext if you want to mix interaction with automatic response

http://www.noah.org/wiki/Pexpect

Falmarri
-1 with no comment? What's wrong with this answer?
Falmarri