Scripting SSH with Python

David M. Cooke cookedm at physics.mcmaster.ca
Tue Oct 24 17:39:39 EDT 2000


At some point, "Lenny Self" <lenny at squiggie.com> wrote:

> Hello, all.
> 
> I am scripting SSH or actually rsync using ssh and I am in need of a bit of
> help.  When I make the SSH connection I am prompted to enter a password...
> my problem is that I don't know how to look for this promt and have the
> script submit the password for me.  Can anyone give me some help on this.
> 
> I have been experimenting with os.popen and os.popen3 but I am either
> looking in the wrong spot or I am not doing it correctly.
> 

I've done this (actually for scp) and it looked like scp was looking
for a tty: if it wasn't connected to a tty, it would pop up an X
window to type the password in. To get around this I fooled it using
the pty module (which according to the documentation works only on
IRIX and Linux, but it also worked on AIX for me) to fool scp into
thinking it's talking to a tty.

-- 
|>|\/|<
----------------------------------------------------------------------------
David M. Cooke
cookedm at mcmaster.ca



More information about the Python-list mailing list