Skip to main content

Keep all ssh connection next to you

Project description

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.

1. Environment

Since 0.2.0 ssh_manager works both on Windows and *NIX, thanks to InquirerPy
  • sshpass - Non-interactive ssh password authentication

  • $servernickname_user - Environment variable that stores the password

Install dependencies

sudo apt install sshpass

  • sshpass -V (Verify sshpass installation)

  • python3 -V (Verify python installation, should be greater than 3.10)

Define environment variable

myserver_root=$(cat ~/SuperSecretPasswordForRoot)

echo $myserver_root
# Here goes the password

2. Installation

As simple as:

pip install ssh-m.py

3. Usage

  • Remote selection:
    • Simply run ssh_m
      > ssh_m
      ssh_manager v0.2.0:
      
      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.2.0:
    
     Hostname: google.com
     Remote user: root
     Environment variable suffix: mygoogle
    
     -----
    
    > root@google.com
      milk@simplifymilk.local
      me@some.example.com
    
    Exampe configuration for new server google.com, with environment variable for it $mygoogle_root
  • Addional 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.

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. Could be any value except empty

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

  • Is alternative to $SSH_M_C environment variable. Could be any value except empty

Important notes

  • Keep in mind that environment variable $servernickname_user is REQUIRED

  • 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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ssh_m_py-0.2.1-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file ssh_m_py-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: ssh_m_py-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for ssh_m_py-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 69640cfed704d312a0df2f5acf74a0a019924ad6d90ed6eee3b6c939d40b469e
MD5 6aba0856460442be3651251389603dc0
BLAKE2b-256 f5a30eaaacd5ca729a442cb10cbe5812e4d1ac54751d0807004ee5ec8fb108f5

See more details on using hashes here.

Supported by

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