paramiko

What it is good for?

Executing commands via SSH.

paramiko allows you to execute Unix commands on another machine by logging in via SSH.
The fabric module gives you a comfortable interface built on top of paramiko.

Installed with Python by default

no

Installed with Anaconda

yes

Example

List the directory on a remote machine.

  1. from paramiko import SSHClient
  2. client = SSHClient()
  3. client.load_system_host_keys()
  4. client.connect('ssh.example.com', username="username", password="password")
  5. stdin, stdout, stderr = client.exec_command('ls -l')

WARNING

Do not hard-code your password inside your Python files. Better read it from a configuration file or environment variable. That way it is less likely that it gets into wrong hands accidentally

Where to learn more?

www.paramiko.org/