Skip to main content

CLI to manage SSH aliases (hosts and targets) and run ssh/scp through aliases.

Project description

managed-ssh

managed-ssh (mssh) is a CLI to manage SSH aliases per user and use them with ssh and scp.

It stores aliases in:

  • ~/.mssh/aliases.json

Alias types:

  • hosts: alias -> host
  • targets: alias -> user@host
  • keys: alias -> /path/to/private_key (optional)

Install

From this repository:

pip install -e .

After install, the command is:

mssh --help

Quick Start

Generate a key in ~/.mssh/keys:

mssh keygen server-a

Generate a key with passphrase (as argument):

mssh keygen server-a "my-passphrase"

Save aliases:

mssh save-host devbox 10.10.10.5
mssh save-target app ubuntu@10.10.10.9

Or autodetect:

mssh save devbox 10.10.10.5
mssh save app ubuntu@10.10.10.9

Save with a specific key:

mssh save-host devbox 10.10.10.5 --key ~/.ssh/devbox.pem
mssh save-target app ubuntu@10.10.10.9 --key ~/.ssh/app.pem

List aliases:

mssh list

Access via SSH:

mssh access devbox
mssh access root@devbox
mssh access ubuntu@10.10.10.9

Override key for a single access:

mssh access devbox --key ~/.ssh/temporary.pem

Copy with SCP (alias resolution on both remote sides):

mssh copy ./local.txt app:/tmp/local.txt
mssh copy root@devbox:/tmp/file.txt ./file.txt

Override key for a single copy:

mssh copy ./local.txt app:/tmp/local.txt --key ~/.ssh/temporary.pem

Commands

  • mssh access <destination>
  • mssh keygen <key_name> [passphrase]
  • mssh copy <source> <target>
  • mssh save-host <alias> <host> [--key <path>]
  • mssh save-target <alias> <user@host> [--key <path>]
  • mssh save <alias> <value> [--key <path>]
  • mssh list
  • mssh delete <alias> [-y]
  • mssh rename <old_alias> <new_alias> [-y]
  • mssh set-key <alias> <path>
  • mssh unset-key <alias>
  • mssh export [--file <path>]
  • mssh import --file <path> [--replace | --overwrite | --skip-existing] [-y]

Export / Import

Export current aliases:

mssh export --file backup-mssh.json

Import and merge, skipping existing:

mssh import --file backup-mssh.json --skip-existing -y

Import and merge, overwriting existing:

mssh import --file backup-mssh.json --overwrite -y

Import replacing everything:

mssh import --file backup-mssh.json --replace -y

Notes

  • If an alias already exists, save asks for confirmation before overwrite.
  • A name cannot exist at the same time as both host and target alias.
  • Keys are used automatically when destination/source uses an alias.
  • In copy, if both sides are remote aliases, mssh can pass both identity files.
  • mssh requires ssh and scp binaries available in your system PATH.

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

managed_ssh-0.1.0.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

managed_ssh-0.1.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file managed_ssh-0.1.0.tar.gz.

File metadata

  • Download URL: managed_ssh-0.1.0.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for managed_ssh-0.1.0.tar.gz
Algorithm Hash digest
SHA256 558166a49d9bbabd7875dbf3c67d4c972dced8fae9ad2cd7314eb895e2ba9599
MD5 c74f1c8d205515a155f4af49f4173eee
BLAKE2b-256 ac4d509513d60af9625abd0f1579463eecb4e7e9e35912e4146ee4249f00b911

See more details on using hashes here.

File details

Details for the file managed_ssh-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: managed_ssh-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for managed_ssh-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4109aefdfe98080818bce301e5adebcb24c5eabe4d035a120c9fb61f78f6b8cf
MD5 257af74ae0fe65a2bb071fdb1a8f22e9
BLAKE2b-256 50636b64a46a62d387e5936f174370ec75e15a8796b21a0f1241ef038dff81b9

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