Python Scriptable SSH

For a simple way of remotely administering machines, over SSH, with Python, have a look at paramiko. You can grab it using easy_install, which can itself be grabbed from PyPi, and installed using sudo sh easy_install_filename.egg.

Here’s a simple script I rustled up, based on the tutorial. It fires up mediatomb, on my server microwave:

If you don’t like using password-less sudo, don’t worry, it can cope with that too. That’s what the second half of the gist above does.

So, if you use SSH for any kind of repetitive system administration, give the article a read, and give paramiko a try.