How to realize ssh & scp in Python

Jeff Epler jepler at unpythonic.net
Sun Jul 24 10:19:54 EDT 2005


Rather than doing anything with passwords, you should instead use public
key authentication.  This involves creating a keypair with ssh_keygen,
putting the private key on the machine opening the ssh connection
(~/.ssh/id_rsa), then listing the public key in the remote system's
~/.ssh/authorized_keys.

If you don't want to use this approach, `pexpect'[1] is supposed to be able
to perform this sort of tasks, and one of its examples is called
`sshls.py'.  I just downloaded it, and after changing the ssh
commandline to include
    -o 'PreferredAuthentications password'
it worked for me.  In another recent thread, a different poster claimed
it didn't work, so your results may vary.

Jeff
[1] http://pexpect.sourceforge.net/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050724/1ee9c19d/attachment.sig>


More information about the Python-list mailing list