Python and ssh for remote login

Michael Torrie torriem at gmail.com
Wed Oct 5 21:54:11 EDT 2016


On 10/05/2016 11:46 AM, Noah wrote:
> Hello folk,
> 
> I would like to use a python script to ssh into a server using a username
> and password and perhaps ass port.
> 
> Any ideas on how to script that.

If paramiko doesn't fit your needs, traditionally this sort of work was
done with the pexpect module for drying a TTY. There is a submodule of
pexpect called pxssh for automating things.

http://pexpect.readthedocs.io/en/stable/api/pxssh.html

Note that pexpect uses your normal ssh binary.  Paramiko is a complete
implementation of the ssh protocol in python.  Both modules are useful
and fill certain needs.



More information about the Python-list mailing list