Interacting with a spawned ssh session?

Steven M. Castellotti scastell at sas.upenn.edu
Mon Jan 15 17:22:23 EST 2001


	I'm having two problems with one function.

	I want to be able to spawn an ssh session to another computer, and then
interact with that session through python commands. (this is on a linux
system)

	The first problem is feeding the password to ssh; I believe that it
wants it's own tty.

	The second problem, and currently the more pressing one, is how to best
send commands to that ssh session, and read back/parse the results.

	I've looked at the pty module, but must not be understanding its
functionality, as I can't get a pty.fork()'d file descriptor to allow me
to perform commands. I'd like to keep away from popen (for security
reasons, though I'm not certain any other method could be considered
secure either), but am still having trouble interacting with the spawned
process (in this case a telnet session; for simplicity).

	Can anyone provide me with, or point me to, any examples of how to use
python to do roughly what I'm describing?

Thanks in advance.


-- 
Steve Castellotti
Systems Programmer
School of Arts and Sciences, University of Pennsylvania



More information about the Python-list mailing list