Interacting with a spawned ssh session?
Chris Watson
chris at voodooland.net
Mon Jan 15 17:43:50 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.
WARNING! WARNING! DANGER WILL ROBINSON! DANGER!
This is a SERIOUS design flaw. Do not do this. Use rsa keys. Unless you
don't care about security. But you are using ssh so I assume you do.
> 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).
Well popen is no more insecure then storing a cleartext password to feed
to ssh above. So I dont see what the problem is in that area.
> Can anyone provide me with, or point me to, any examples of how to use
> python to do roughly what I'm describing?
Im sure someone will tell you exactly how to manipulate a running process.
But PLEASE use rsa keys for ssh and not passwords.
--
=============================================================================
-Chris Watson (316) 326-3862 | FreeBSD Consultant, FreeBSD Geek
Work: scanner at jurai.net | Open Systems Inc., Wellington, Kansas
Home: scanner at deceptively.shady.org | http://open-systems.net
=============================================================================
WINDOWS: "Where do you want to go today?"
LINUX: "Where do you want to go tomorrow?"
BSD: "Are you guys coming or what?"
=============================================================================
GNU = Gnu's Non-portable & Unstable
irc.openprojects.net #FreeBSD -Join the revolution!
ICQ: 20016186
More information about the Python-list
mailing list