Python SSH

When the number of machines you are trying to manage grows there will come a time when you want to do more than just run Python on the local machine; you want to manage servers remotely. If that server is *nix derived then that means SSH.

Python naturally has a module for SSH connections called Paramiko. Installing the Paramiko module  is a straight forward with pip (pip install paramiko) but it has a dependency on the C module PyCrypto. If you are on Windows, the best way to install this is using an installer from VoidSpace.

Once installed you can connect to a server using SSH in just a few lines of code. I could repeat the code from several other blogs here but instead I’ll just point you to an article written for Python Magazine which does a decent job of explaining the basics.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s