Skip to main content

ssh_manager

TOML Python

Master Status PyPI - Version

- Keep all ssh connection next to you

And don't distract on password prompts

ssh_manager: 

usage: ssh_m [-h] [-n] [-R] [-C]

optional arguments:
  -h, --help  show this help message and exit
  -n          Proceed new SSH connection to storage Executed by default if storage is empty.
  -R          Acts same as $SSH_M_R Prevents renaming TMUX window on SSH connection.
  -C          Acts same as $SSH_M_C Prevents closing of TMUX after SSH is disconnected.
Since 0.2.0 ssh_manager works both on Windows and *NIX, thanks to InquirerPy

1. Environment

General:
  • python3 - is an interpreted, interactive, object-oriented, open-source programming language.
  • ssh - OpenSSH-compatible client

Password connections:
  • sshpass - Non-interactive ssh password authentication
  • Define user-specific environment variable
    • Unix-like:
      myserver_root=$(cat ~/SuperSecretPasswordForRoot)
      
    • Windows:
      $env:myserver_root=$(cat ~/SuperSecretPasswordForRoot)
      

SSH-key connections:
  • IdentityFile - Private key for remote machine, could be placed anywhere

2. Install dependencies

(Optional, required for password-based SSH connections)

Using APT:

sudo apt install sshpass

Homebrew:

brew install sshpass

Other *NIX:

1. Download .tar.gz source code

2. Extract archive and enter directory: tar -xf sshpass*.tar.gz && rm sshpass*.tar.gz && cd sshpass*

3. Run as following:

./configure
make
sudo make install
Or installation without sudo-access setting the --prefix

Windows (experimental):

1. Download sshpass-win32

2. [Optional] Check your PATH environment variable

  • [Win + R] -> SystemPropertiesAdvanced.exe
  • Environment variables -> Path -> Edit

3. Drop sshpass.exe to one of present folder in Path

Verify everything is installed properly

  • sshpass -V (Check, that sshpass is installed and operable)

  • echo $myserver_root
        -----
    # Here goes the password
    

3. ssh_manager Installation

As simple as:

pip install ssh-m.py

4. Usage

  • Remote selection:
    • Simply run ssh_m
      > ssh_m
      ssh_manager v0.x.y:
      
      Select SSH user:
      >me@some.example.com
        milk@simplifymilk.local
      
      
  • Add new remote
    • ssh_m -n
    • Or press "n" key at ssh_m menu
    ssh_manager v0.x.y:
    
     Hostname: google.com
     Remote user: root
     ? Select connection type: Env
     Environment variable prefix: mygoogle
    
     -----
    
    > root@google.com
      milk@simplifymilk.local
      me@some.example.com
    
    Example configuration for new server google.com, with environment variable for it $mygoogle_root
  • Additional controls
    • [n] key - Create new entry in list while in menu
    • [d] key - Delete hovered entry
    • [q] or [Ctrl-C] or [Ctrl-D] - Close ssh_manager

Configuration

The default storage is JSON file type, that placing in home location:

~/.ssh_manager_store

Remember, the storage contains NO any sensitive information. It just a mapping for environment variable names and paths to key files.

Also, as mentioned before ssh_manager aims to rename TMUX active window and close pane at session disconnect. There's a few options how to configure that behavior:

Launch arguments

@ ssh_m -R - [R]ename - will prevent ssh_manager renaming active TMUX window

  • Is alternative to $SSH_M_R environment variable.

@ ssh_m -C - [C]lose - will prevent ssh_manager closing pane after SSH terminated

  • Is alternative to $SSH_M_C.

Important notes

  • Keep in mind that for password-based logins environment variable $servernickname_user is REQUIRED, otherwise use key-based entry

  • You can specify any port for SSH using : delimeter after hostname, or specify explicitly -p flag

  • ssh_manager by default is checking whether running inside TMUX, and applies those actions to it

    • Renaming current window to active ssh session
    • Termination shell on ssh disconnect

Metadata

Release files for ssh-m.py 0.3.2

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

Built distribution (wheel)

Table of built distributions (wheels) for ssh-m.py 0.3.2
File Interpreter ABI Platform
ssh_m_py-0.3.2-py3-none-any.whl Python 3 none any Details

Release files / ssh_m_py-0.3.2-py3-none-any.whl

Download URL ssh_m_py-0.3.2-py3-none-any.whl
Size 14.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e968b1db63389d25f6e20c684adb5c621dc9c05fc90954bd23d4a6de34a32fc8
BLAKE2b-256 checksum
How to use checksums
ec24394344cfd8271388f8126e52b1038f192621582245860deed8a5b262ecb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.1.1 CPython/3.12.7

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 13, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.3.2 This release

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.1

1 release file

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