A modern command-line tool to manage your SSH connections with style. Easily manage your SSH config file with a beautiful interface.
- π Simple and intuitive CLI interface
- π List all SSH connections in a beautiful table format
- β Add new SSH connections interactively or via command line
- π Update existing connections with ease
- ποΈ Remove connections safely with confirmation
- π Connect to hosts using simple aliases
- π¦ ProxyJump support for bastion hosts
- π Local Port Forwarding support
- π Automatic backup of SSH config file
- π Beautiful terminal UI using Rich
- π Search and filter connections
- π§ͺ Test SSH connectivity before connecting
- βοΈ Configurable settings and preferences
- π€ Export/Import connections
- π‘οΈ Input validation and error handling
# One-liner installation
curl -sSL https://raw.githubusercontent.com/palace22/sshm/main/install.sh | bashpip install --user git+https://github.com/palace22/sshm.gitgit clone https://github.com/palace22/sshm.git
cd sshm
pip install --user -e ".[dev]"If the sshm command is not found after installation, add ~/.local/bin to your PATH:
# For Zsh users
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc
source ~/.zshrc
# For Bash users
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
source ~/.bashrcsshm --help# List all connections
sshm list
# Add a new connection (interactive)
sshm add
# Add a connection via command line
sshm add --name myserver --hostname example.com --user myuser --port 2222
# Connect to a host
sshm connect myserver
# Update a connection
sshm update myserver --hostname new-example.com
# Remove a connection
sshm remove myserver
# Test a connection
sshm test myserver
# Search connections
sshm list --search web
# Show detailed view
sshm list --detailed
sshm list --format json # Output in JSON format
sshm list --search prod # Search for connections containing 'prod'sshm add # Interactive mode
sshm add --name myserver --host example.com --user admin --port 22 # Direct modesshm update myserver # Interactive mode
sshm update myserver --host new-example.com # Update specific fieldssshm remove myserver # With confirmation
sshm remove myserver --force # Force remove without confirmationsshm connect myserver # Connect to a server using its alias
sshm connect myserver --dry-run # Show the SSH command without executingTo connect through a jump host (bastion), first define the bastion as its own connection:
# 1. Add the bastion host
sshm add --name my-bastion \
--hostname 203.0.113.10 \
--user ec2-user \
--identity-file ~/.ssh/bastion-key.pem
# 2. Add the target server with ProxyJump
sshm add --name private-server \
--hostname 10.0.0.50 \
--user ubuntu \
--identity-file ~/.ssh/server-key.pem \
--proxy-jump my-bastion
# 3. Connect (automatically jumps through bastion)
sshm connect private-serverThis generates the following SSH config:
Host my-bastion
HostName 203.0.113.10
User ec2-user
IdentityFile ~/.ssh/bastion-key.pem
Host private-server
HostName 10.0.0.50
User ubuntu
IdentityFile ~/.ssh/server-key.pem
ProxyJump my-bastion
Note: Both the bastion and target need their
IdentityFilespecified. The bastion key authenticates with the jump host, and the target key authenticates with the final server.
Forward a remote port (e.g., a database) to your local machine:
# Add a connection with port forwarding
sshm add --name db-tunnel \
--hostname 203.0.113.10 \
--user admin \
--local-forward 5432:database.internal:5432
# Connect and access database at localhost:5432
sshm connect db-tunnelYou can also combine ProxyJump with port forwarding:
sshm add --name db-tunnel \
--hostname 10.0.0.100 \
--user ubuntu \
--proxy-jump my-bastion \
--local-forward 5432:localhost:5432The tool manages connections in your SSH config file (~/.ssh/config). Each entry follows this format:
Host myserver
HostName example.com
User admin
Port 22
IdentityFile ~/.ssh/id_rsa
# Additional SSH options...
SSH Manager respects your existing SSH config file and makes safe modifications. Configuration options:
# Set default SSH key
sshm config set default_key ~/.ssh/id_rsa
# Set backup directory
sshm config set backup_dir ~/.ssh/backups
# Enable/disable automatic backups
sshm config set auto_backup true# Clone the repository
git clone https://github.com/yourusername/ssh-manager
cd ssh-manager
# Install poetry
curl -sSL https://install.python-poetry.org | python3 -
# Install dependencies
poetry install
# Setup pre-commit hooks
poetry run pre-commit installpoetry run pytestThis project uses:
- Black for code formatting
- isort for import sorting
- mypy for type checking
- pre-commit hooks to enforce quality
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the GPL-3.0 License - see the LICENSE file for details.
