Paramiko

4.0.0 · active · verified Sat Mar 28

Paramiko is a native Python SSHv2 protocol library, providing both client and server functionality. The current version is 4.0.0, released on March 28, 2026. It follows a regular release cadence, with updates and patches released as needed.

Warnings

Install

Imports

Quickstart

A basic example demonstrating how to use Paramiko to connect to an SSH server and execute a command. Replace 'hostname', 'user', and 'password' with your server's details, or set them as environment variables.

import os
from paramiko import SSHClient, AutoAddPolicy

# Set up SSH client
client = SSHClient()
client.set_missing_host_key_policy(AutoAddPolicy())

# Connect to the server
client.connect(os.environ.get('SSH_HOST', 'hostname'), username=os.environ.get('SSH_USER', 'user'), password=os.environ.get('SSH_PASSWORD', 'password'))

# Execute a command
stdin, stdout, stderr = client.exec_command('ls')
print(stdout.read().decode())

# Close the connection
client.close()

view raw JSON →