Skip to main content

A lightweight, ergonomic SSH library.

Project description

EZSSH

An Ergonomic and Lightweight SSH Library.

Installation

pip install ezssh

Quick Start

from ezssh import SSHRunner, Command, BatchPolicy

# As of v0.0.9, SSHRunner will auto-add on new host. Disable for added security.
with SSHRunner(
    host="10.0.0.5",
    username="ubuntu",
    password="secret", # password as null will attempt pubkey
    missing_host_key_policy='autoadd'
) as runner:

    result = runner.run("uname -a")
    print(result.stdout)

    batch = runner.run_batch(
        [
            "whoami",
            Command("systemctl is-active ssh", sudo=True, name="ssh_status"),
        ],
        policy=BatchPolicy(stop_on_failure=False),
    )

    for r in batch.results:
        print(r.command.name, r.exit_status)

Batch Operations

batch processing of cli commands is also available. To execute a chain of prepared commands:

batch = runner.run_batch(
    [
        Command("mkdir -p /tmp/example"),
        Command("touch /tmp/example/file.txt"),
        Command("false", name="intentional_failure"),
        Command("echo still runs"),
    ],
    policy=BatchPolicy(stop_on_failure=False),
)
# Each returns an exit status, stdout/stderror, start/end and duration.

Authentication Behavior

Password auth uses password only, agent and key discovery are opt-in.

SSHRunner(
    host="example.com",
    username="user",
    password="secret",
    allow_agent=False,
    look_for_keys=False,
)

When to Use ezssh

Use ezssh if you need:

  • Programmatic SSH execution embedded in a Python application
  • Deterministic batch execution with structured results
  • Explicit authentication behavior
  • Lightweight automation without orchestration frameworks

Do not use ezssh if you need:

  • Configuration management
  • Long-lived agents
  • Inventory management
  • Declarative state convergence

How ezssh Compares

Tool ezssh Paramiko Fabric Ansible
Embedded in apps ⚠️ ⚠️
Batch semantics ⚠️
Explicit auth ⚠️
Minimal deps
YAML required

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezssh-0.0.9.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezssh-0.0.9-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file ezssh-0.0.9.tar.gz.

File metadata

  • Download URL: ezssh-0.0.9.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ezssh-0.0.9.tar.gz
Algorithm Hash digest
SHA256 9f47f0a0f980bab795521b4f7445366733654b8cebe19fd30730bb11a110ad07
MD5 6cefe7fded1e83e896d12f7a10afd9c3
BLAKE2b-256 a8d87bafb61d6e153d3ac83b8227a03cb9d42855c2e82f130416d7152069f6d2

See more details on using hashes here.

File details

Details for the file ezssh-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: ezssh-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for ezssh-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 fa1cc8d59c5662c8756f150b43fa28eb8185d88424b04dc3a1dd201c81889663
MD5 712c1ff851cad54e4ed76b93dc7cf59e
BLAKE2b-256 f2c736c0074ed5d3bdc705cd9350d74124c7cb03c250ce84c0ad51b464454967

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page