Scripting SSH with Python

Erik Myllymaki erik at pacific-shores.com
Wed Oct 25 02:21:33 EDT 2000


in article qnklmvd6hr8.fsf at arbutus.physics.mcmaster.ca, David M. Cooke at
cookedm at physics.mcmaster.ca wrote on 10/24/2000 2:39 PM:

> 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.

I had a similar question a while back and solved it with non-password
authentication and some help from this page:

www.freebsddiary.org/secure-file-copy.html

Worked like a charm for me.

Erik Myllymaki
erik at pacific-shores.com




More information about the Python-list mailing list