Skip to main content

PyPI Downloads Stars Python License CI

Tested on Linux, macOS, and Windows

Remote CMD — SSH Server Management
Without the Overhead

English · 中文

pip install remote_cmd_manager  ·  Quick Start  ·  Use Cases  ·  CLI Reference  ·  Python API  ·  Documentation  ·  Contributing


Remote CMD is a lightweight Python CLI + API for managing servers over SSH. Add hosts, run commands, transfer files, and organize hosts with tags — no Ansible DSL or shell loops required.

# One command to get started
pip install remote_cmd_manager && remote-cmd host add web-01 192.168.1.10 ubuntu --key ~/.ssh/id_rsa && remote-cmd run web-01 "uptime"

v2.10.0 Release Highlights

v2.10.0 is a maintenance & quality release: CI signal hardening, package-wide mypy strict, dependency auditing, and secret scanning. No new user features; public APIs are unchanged. See the full migration notes.

CI Reliability

  • Codecov step migrated to the current files: input (codecov/codecov-action@v6) — the workflow warning is gone.
  • test_pending_count no longer depends on fixed sleeps: it observes the PENDING state with a bounded wait and repeats 20× — the macOS timing flake is removed.

Type Quality

  • mypy strict now covers the entire remote_cmd package (previously strict = false despite the README claim); all baseline errors fixed with real annotations, no blanket ignores.
  • Strict typing surfaced and fixed a latent bug: async execute_sudo(password=...) wrote str into a bytes stream and would crash on real connections — it now writes UTF-8 bytes with a regression test.

Supply-Chain Checks

  • New CI dependency-audit job: pip-audit on an isolated runtime-deps venv is blocking; dev tooling audit is advisory.
  • New CI secret-scan job: gitleaks with a minimal allowlist (generated docs/build artifacts and the local hosts.json only).

Table of Contents


Why Remote CMD?

Feature remote-cmd ssh + shell Ansible Fabric
Host CRUD + tag groups ✅ Built-in ❌ Manual ✅ Inventory ❌
Batch commands across hosts ✅ batch-run ❌ Write a loop ✅ Playbook ✅
File transfer (upload/download) ✅ Built-in ✅ scp ✅ copy module ✅
Python API ✅ from remote_cmd import ... ❌ ❌ YAML-only ✅
Zero setup ✅ pip install → go ❌ Configure SSH ❌ ansible.cfg ❌
Learning curve Low Low High Medium

Use remote-cmd when you need a CLI that works immediately for ad-hoc SSH tasks. Use Ansible when you need full configuration management and idempotent playbooks.


Quick Start

# 1. Install
pip install remote_cmd_manager

# 2. Add a server
remote-cmd host add web-01 192.168.1.10 ubuntu --key ~/.ssh/id_rsa

# 3. Run a command
remote-cmd run web-01 "uptime"

# 4. Run across named production servers
remote-cmd batch-run web-01 web-02 db-01 "df -h /"

Use Cases

🖥️ System Administrators — Check disk across 20 servers in one command

remote-cmd batch-run web-01 web-02 db-01 "df -h / | tail -1"
# Output:
#   ✓ web-01  → /dev/sda1  32G  12G  19G  40% /
#   ✓ web-02  → /dev/sda1  32G  28G   3G  90% /   ⚠️
#   ✗ db-01   → Connection refused

🚀 Deploy — Pull code and restart a service

from remote_cmd.service.host_service import HostService
from remote_cmd.repository import JsonHostRepository

service = HostService(repository=JsonHostRepository("hosts.json"))
for host in service.list_hosts(tag="staging"):
    with service.connect_to_host(host.name) as client:
        client.execute("cd /app && git pull")
        client.execute("pip install -r requirements.txt")
        client.execute_sudo("systemctl restart app", password="sudopass")

🔥 Incident Response — Check logs across all servers

remote-cmd batch-run web-01 web-02 "journalctl -xe -n 50 | grep -i error"

🔧 Config Update — Upload and reload nginx across tagged hosts

# Upload new config, reload across web servers
remote-cmd run web-01 "sudo cp /tmp/nginx.conf /etc/nginx/nginx.conf && sudo nginx -t && sudo systemctl reload nginx"

CLI Reference

All operations are available from the terminal:

Command Description
remote-cmd host add <name> <host> <user> Register a server (-k/--key, -p/--port, -t/--tag, repeatable)
remote-cmd host list [-t TAG] List hosts, optionally filtered by tag
remote-cmd host show <name> Show one host's details
remote-cmd host test <name> Test connectivity to a host
remote-cmd host remove <name> Remove a host
remote-cmd run <name> "<cmd>" [-T SECONDS] Run a command on one host (--timeout/-T sets the wall-clock limit)
remote-cmd upload <name> <local> <remote> Upload a file via SFTP
remote-cmd download <name> <remote> <local> Download a file via SFTP
remote-cmd batch-run <name>... "<cmd>" Run across named hosts (-C concurrency, -T timeout, -r retries, --async, --show-failures)

Python API

Use Remote CMD inside your own scripts and automation:

from remote_cmd.core.ssh_client import SSHClient, ConnectionConfig

config = ConnectionConfig(
    hostname="192.168.1.100",
    username="ubuntu",
    key_filename="~/.ssh/id_rsa",
)

with SSHClient(config) as client:
    # Execute commands
    result = client.execute("uptime")
    print(result.stdout)

    # Transfer files
    client.upload_file("./local.txt", "/remote/path/file.txt")
    client.download_file("/remote/path/file.txt", "./local.txt")

    # List remote directory
    for entry in client.list_remote_directory("/var/log"):
        print(f"{entry.name}: {entry.size} bytes")

Features

Category Details
SSH Auth Password + key file + ssh-agent, with pluggable credential providers
Credential Chain Source passwords from environment, keyring, or arbitrary providers, in priority order
Credential Encryption Fernet-encrypt secrets at rest (CredentialEncryption)
Commands Single, multi-line, sudo with password
File Transfer Upload/download via SFTP (remote-cmd upload/download)
Host Management CRUD with pluggable JSON or SQLite persistence
Connection Profiles Reusable username/port/key/tag defaults referenced by hosts (ProfileService, --profile); never stores credentials
Secure Recipes Typed command templates (shell_arg auto-quoted / env exported), stored in the repository and run across hosts; no raw interpolation
Output Formats --format rich|json|table for run / batch-run (stable JSON schema, parseable stdout)
Tag System Filter hosts by tag (e.g., production, web, db); profile tags participate in filtering
Batch Ops Run commands across any host group, synchronously or asynchronously; optional per-host retained-output cap (max_output_bytes)
Async Kernel AsyncSSHClient / AsyncConnectionPool / AsyncBatchExecutor via the [async] extra
Global Connection Budget Optional ConnectionBudget caps live SSH connections process-wide across pools and executors
Task Runner Track and schedule long-running remote tasks with statuses (TaskRunner)
Connection Test Test all host SSH connections and report status
Secure Logging Structured logging that filters sensitive data (SensitiveDataFilter)
Type Safety Full type annotations; mypy strict across the remote_cmd package

Cross-Platform Support

remote-cmd is a pure-Python client, tested and supported on Linux, macOS, and Windows. No native dependencies or platform-specific builds are required.

Platform Status Notes
Linux ✅ Fully tested Primary development platform
macOS ✅ Supported Use brew install openssh for a newer OpenSSH
Windows ✅ Supported PowerShell / CMD / WSL all work

Note on Windows file permissions: Credential encryption keys are protected with 0600 permissions on Unix. On Windows this restriction is not enforced by the filesystem — the key file is still encrypted at rest. For production Windows use, consider adding filesystem-level ACLs.


Installation

# From PyPI (recommended) — keeps API and CLI in sync
pip install remote_cmd_manager

# With native async support (AsyncSSHClient / AsyncConnectionPool / AsyncBatchExecutor)
pip install "remote_cmd_manager[async]"

# From source
git clone git@github.com:Vae-Scrooge/remote-cmd.git
cd remote-cmd
pip install -e ".[dev]"

The [async] extra installs asyncssh and enables the native async execution kernel: AsyncSSHClient, AsyncConnectionPool and AsyncBatchExecutor (also available via BatchExecutor(use_async=True)). BatchExecutor(use_async=True) also requires this extra. Without it, import remote_cmd still works — the async symbols are simply not exported.


Documentation

📚 Full Documentation Center — tutorials, API reference, architecture, and troubleshooting

Document Contents
API Reference Full API docs: SSHClient, AsyncSSHClient, HostService, and more
API Docs (auto-generated) Complete API reference generated by pdoc
Quickstart Tutorial Step-by-step walkthrough
Advanced Tutorial Batch ops, error handling, production patterns
Architecture System architecture and design decisions
Development Guide Set up the dev environment, contributing
Troubleshooting Common issues and solutions
Changelog Release history
Mobile Remote Guide Manage servers from your phone

Note: The documentation center and tutorials are maintained in English. See README.zh-CN.md for the Chinese version of this page.


Project Status

Stable. The core API is stable and versioned under semantic versioning. Breaking changes are communicated via major-version bumps, and the public API surface has been stable since the 1.x line.

Roadmap:

  • Async SSH operations (parallel execution) — v1.1.0
  • Pluggable storage backends (JSON + SQLite) — v1.2.x
  • Chainable credential providers + at-rest encryption — v1.2.x
  • Configuration profiles (AWS, GCP, custom) — v2.8.0
  • Output formatting (JSON, table) — v2.8.0
  • Templated command recipes (typed variables, shell-quoted) — v2.9.0

Good first issues are labelled good first issue in the issue tracker — contributions welcome.


Maintainership

Remote CMD is an actively maintained open-source project. It is designed and developed independently as a focused alternative to heavyweight tools for the ad-hoc SSH tasks that come up in day-to-day server work.

  • Project health: CI runs on every PR, Python 3.10+ is supported, and the public API is versioned under semantic versioning.
  • Your code, your servers: usage stays open under the MIT license — nothing is telemetry-driven or locked behind a service.
  • Why open source? The tooling around ad-hoc SSH administration was either too heavy (Ansible) or too bare (raw shell loops). Remote CMD exists so that a single command can cover the common 90% of remote admin.

Contributing

We welcome contributions! See CONTRIBUTING.md to get started.

Before contributing, please read our Code of Conduct.


License

MIT © Vae-Scrooge


Star
If you find this project useful, star it on GitHub ⭐

Metadata

Release files for remote-cmd-manager 2.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for remote-cmd-manager 2.11.0
File Size Uploaded
remote_cmd_manager-2.11.0.tar.gz 247.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for remote-cmd-manager 2.11.0
File Interpreter ABI Platform
remote_cmd_manager-2.11.0-py3-none-any.whl Python 3 none any Details

Total release size: 398.4 kB

Release files / remote_cmd_manager-2.11.0.tar.gz

Download URL remote_cmd_manager-2.11.0.tar.gz
Size 247.2 kB
Tags Source
SHA-256 checksum
How to use checksums
33bc9fc5fa2441a579d8bfa006cb7532836396a083def9e8ebebc659a51889fc
BLAKE2b-256 checksum
How to use checksums
155ca8af9a4aff9d0257c11b9558f429ad75ed4562726c5b55d79dc3501fbf08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release files / remote_cmd_manager-2.11.0-py3-none-any.whl

Download URL remote_cmd_manager-2.11.0-py3-none-any.whl
Size 151.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0373ac1e1df7485925e4119bda371527303f752ecad64ccdcdf9d7fd234db0a
BLAKE2b-256 checksum
How to use checksums
165227c5eb41a39f6867ba674877bcb4db1a241a208ecc234f96006dffec25ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 5, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.11.0 This release

2 release files

2.10.0

2 release files

2.9.0

2 release files

2.8.1

2 release files

2.8.0

2 release files

2.7.0

2 release files

2.6.0

2 release files

2.5.0

2 release files

2.4.0

2 release files

2.3.0

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page