DevOps & Cloud

paramiko

The engine that lets Python speak fluent SSH, the secure language computers use to remote-control each other.

Install it: pip install paramiko

What does it do?

When you connect securely to a remote server, the way an IT admin logs into a company machine from home, that connection uses a protocol called SSH. Paramiko is a from-scratch Python implementation of that protocol, meaning it doesn’t just call out to your operating system’s SSH program, it actually speaks the SSH language itself in pure Python. That lets a script open a secure connection, run commands, and transfer files to another machine without shelling out to external programs. It’s the low-level engine that friendlier tools like Fabric build on top of.

See it in action

This securely logs into a remote server, runs a command to list its files, prints the result, and disconnects.

import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("your-server.com", username="user", password="your_password_here")

stdin, stdout, stderr = client.exec_command("ls -la")
print(stdout.read().decode())

client.close()

Why would a non-developer care?

Secure remote access is the backbone of how the internet’s infrastructure gets managed — every server update, every automated deployment, every file quietly synced between data centers likely passes through an SSH connection at some point. Paramiko is one of the reasons Python became a serious language for that kind of infrastructure work.

Real-world examples

Paramiko is used inside countless automation tools, including as the connection layer for Fabric and parts of Ansible’s SSH-based operations. Without a library like it, every Python program needing secure remote access would have to either shell out to the command-line ssh tool, which is clunky to control precisely, or implement the SSH protocol itself, a serious undertaking.

Who uses it

Developers building automation, deployment, or file-transfer tools that need direct, programmatic control over SSH connections.

How it compares to alternatives

Fabric and Invoke sit on top of Paramiko to make it friendlier for everyday scripting, so most people use those instead of touching Paramiko directly unless they need fine-grained protocol control.

Fun fact

Paramiko was created by Robey Pointer in the early 2000s as one of the first pure-Python SSH implementations, and it’s still the foundation many higher-level tools quietly depend on today.

New to Python and want to actually try libraries like this yourself?

Find a beginner-friendly course

Related libraries