Friday, March 11, 2016

Spur SSH Client in Python

Spur is a SSH client which can be used to invoke commands on a remote machine. This is similar to Paramiko.

For spur, install the module first

pip install spur

A simple spur client looks as follows:


#!/usr/bin/python

import sput

# Password can be provided in place of ssh key
shell=spur.SshShell(<address of remote machine,
                    <valid user in remote machine>, 
                    private_key_file=<Private SSH key file>,
                    missing_host_key=spur.ssh.MissingHostKey.accept)

# Make a dir in remote machine
with shell:
        shell.run(["mkdir","temp"])

No comments:

Post a Comment