Using Python to run SSH commands on a remote server

Jean-Paul Calderone exarkun at divmod.com
Mon Jun 23 13:46:12 EDT 2008


On Mon, 23 Jun 2008 13:30:55 -0400, John Salerno <johnjsal at nospamgmail.com> wrote:
>Generally speaking, what tools would I use to do this? Is there a built-in
>module for it? I looked at the telnetlib module, but the documentation
>wasn't really complete enough for me to get a good idea of it. Is Telnet and
>SSH even the same thing?

Telnet and SSH are different things.  There's nothing in the standard library
for making an SSH connection (aside from the process control libraries, which
let you run an external SSH client in a child process).

>
>Basically, I want to write a script that will automate the process of making
>all .py files on my web server executable (chmod 755, or something similar).

There are several third-party SSH libraries, eg Twisted Conch and Paramiko.

Jean-Paul



More information about the Python-list mailing list