Skip to main content

PyPI Downloads Stars Python License CI Code Style

Remote CMD — SSH Server Management
Without the Overhead

pip install remote_cmd_manager  ·  Quick Start  ·  Use Cases  ·  Python API  ·  Docs  ·  Contributing

Demo


Remote CMD is a lightweight Python CLI + API for managing servers over SSH. Add hosts, run commands, transfer files, and target groups by 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"

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 ❌ Config 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 all production servers
remote-cmd batch-run -t production "df -h /"

Use Cases

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

remote-cmd batch-run -t production "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 service

from remote_cmd.service.host_service import HostService
from remote_cmd.repository.json_host_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 -t web "journalctl -xe -n 50 | grep -i error"

🔧 Config Update — Upload and reload nginx across tagged hosts

# Upload new config
scp nginx.conf user@server:/tmp/nginx.conf  # or use the upload command
remote-cmd run web-01 "sudo cp /tmp/nginx.conf /etc/nginx/nginx.conf && sudo nginx -t && sudo systemctl reload nginx"

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
Commands Single, multi-line, sudo with password
File Transfer Upload/download via SFTP
Host Management CRUD with JSON/YAML persistence
Tag System Filter hosts by tag (e.g., production, web, db)
Batch Ops Run commands across any host group
Connection Test Ping all hosts and report status
Type Safety Full type annotations + mypy strict

Installation

# From PyPI (recommended) — 同步 API 与 CLI
pip install remote_cmd_manager

# With async native 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)). Without it, import remote_cmd still works — async symbols are simply not exported.


Documentation

📚 完整文档中心 — 教程、API 参考、架构设计、故障排查

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
Development Guide Setup dev environment, contributing
Troubleshooting Common issues and solutions
Changelog Release history
Mobile Remote Guide Manage servers from your phone

Project Status

Beta. The core API is stable. Breaking changes will be communicated via semantic versioning.

Roadmap:

  • Async SSH operations (parallel execution) — v1.1.0
  • Configuration profiles (AWS, GCP, custom)
  • Output formatting (JSON, table)

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

Download files

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

Source Distribution

remote_cmd_manager-1.2.1.tar.gz (108.0 kB view details)

Uploaded Source

Built Distribution

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

remote_cmd_manager-1.2.1-py3-none-any.whl (69.3 kB view details)

Uploaded Python 3

File details

Details for the file remote_cmd_manager-1.2.1.tar.gz.

File metadata

  • Download URL: remote_cmd_manager-1.2.1.tar.gz
  • Upload date:
  • Size: 108.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for remote_cmd_manager-1.2.1.tar.gz
Algorithm Hash digest
SHA256 1099e35f8fc02bb6c8f55ffcce75521839045bf72b56f2a78c1f8b7b4275fa42
MD5 105978da4fb0ab35c8bf95e143c008bb
BLAKE2b-256 7f8ccb43f8d0187e21618730c916a92aaf1621eeffad1f11e59a95297a15bd33

See more details on using hashes here.

Provenance

The following attestation bundles were made for remote_cmd_manager-1.2.1.tar.gz:

Publisher: publish.yml on Vae-Scrooge/remote-cmd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file remote_cmd_manager-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for remote_cmd_manager-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ba93b86abf188d7b9864928c63752d91d6896877c99ed35530d02e5fd0e3707
MD5 d8f9af16bd7329a50f573714aef0474a
BLAKE2b-256 1c58557ae15895295f701a00f07bec6975dae34ff11cc0ebc8010359c0cf87d1

See more details on using hashes here.

Provenance

The following attestation bundles were made for remote_cmd_manager-1.2.1-py3-none-any.whl:

Publisher: publish.yml on Vae-Scrooge/remote-cmd

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

2.9.0

2 files

2.8.1

2 files

2.8.0

2 files

2.7.0

2 files

2.6.0

2 files

2.5.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.0

2 files

1.2.3

2 files

1.2.2

2 files

This release

1.2.1 This release

2 files

1.2.0

2 files

1.1.1

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 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