A bash script to easily manage SSH connections with custom aliases.
Manage your SSH connections like a pro! Add, edit, list and connect to your servers with simple commands. Features password clipboard integration, auto-update, SSH key management and a beautiful interface.
# Add a new connection
conn add
# List all your servers
conn list
# Connect to a server
conn to myserverClone the repository from GitHub:
git clone https://github.com/andreapollastri/ssh-connection-manager.git
cd ssh-connection-managerRun the installation script:
chmod +x install.sh
./install.shAfter installation, you can use the conn command from any directory!
If you prefer not to install globally:
chmod +x conn
./conn <command>| Command | Description |
|---|---|
conn add |
Add a new SSH connection |
conn list |
Display all saved connections in a beautiful table |
conn info <alias> |
Show detailed information about a connection |
conn to <alias> |
Connect to a server by alias |
conn edit <alias> |
Edit an existing connection |
conn remove <alias> |
Remove a connection |
conn reset <alias> |
Reset SSH host keys |
conn key <action> |
Manage SSH keys (public/private/create) |
conn update |
Update script to latest version |
conn help |
Show help message |
conn addYou will be prompted to enter:
- Alias: short name to identify the server
- User: SSH username (default: root)
- Host: IP address or hostname of the server
- Port: SSH port (default: 22)
- Password: (optional) will be copied to clipboard during connection
Example:
Type alias: myserver
Type user (default: root): andrea
Type host: 192.168.1.100
Type port (default: 22): 2222
Password (optional - will be copied to clipboard during connection): ********
conn listExample output:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β SSH SERVERS LIST β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ALIAS USER HOST PORT
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
myserver andrea 192.168.1.100 2222
production root prod.example.com 22 π
staging deploy staging.example.com 2222
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π‘ Tip: Use conn to <alias> to connect
π = Connection with saved password
conn info <alias>Shows detailed information about a specific connection.
Example:
conn info myserverExample output:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CONNECTION INFO β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Alias: myserver
User: andrea
Host: 192.168.1.100
Port: 2222
Connection: [email protected]:2222
Password: mysecretpassword β οΈ visible in plain text
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π‘ Tip: Use conn to myserver to connect
conn to <alias>Example:
conn to myserverThe script will:
- Check if SSH key exists (warns if missing)
- Check for script updates (warns if available)
- Copy saved password to clipboard (if present)
- Connect via SSH
conn edit <alias>Allows you to modify an existing connection. Press Enter to keep the current value, or type a new one to change it.
Example:
conn edit myserverconn remove <alias>You will be asked for confirmation before proceeding.
Example:
conn remove myserverconn reset <alias>Executes ssh-keygen -R to remove the host's SSH keys (useful in case of "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED").
Example:
conn reset myserverconn key <action>Available actions:
public- Show your SSH public keyprivate- Show your SSH private key (β οΈ keep it secret!)create- Generate a new SSH key pair (id_rsa)
Examples:
conn key public # Show public key
conn key create # Create new SSH key pairconn updateDownloads and installs the latest version from GitHub. Automatically uses sudo if the script is installed in a system directory.
conn helpConnections are saved in:
~/.ssh_connections.conf
The file uses the format: alias|user|host|port|password
You can manually edit this file to backup or modify connections.
- β Beautiful table interface with colors and Unicode characters
- β Detailed connection info - view complete connection details
- β Password management - automatically copied to clipboard during connection
- β Edit connections - modify existing connections without recreating them
- β SSH key management - create, view public/private keys
- β Auto-update - check and install updates from GitHub
- β Smart checks - warns if SSH key is missing or updates are available
- β Alphabetically sorted connections list
- β Default values for user (root) and port (22)
- β Input validation and confirmation prompts
- β Automatic SSH key reset for host identification issues
- β No external dependencies (bash + standard Unix tools)
- macOS (or any Unix-like system)
- Bash
- Git
- SSH client installed
- Optional: SSH key pair (
id_rsa) - can be created withconn key create
- Connections are saved in a simple text file (
~/.ssh_connections.conf) - Each user has their own configuration file
- Passwords are stored in plain text - use SSH keys when possible for better security
- Passwords (if saved) are automatically copied to clipboard during connection
- macOS: uses
pbcopy(native) - Linux: uses
xcliporxsel(install if needed)
- macOS: uses
- The script automatically checks for updates when connecting
- Backups are created when updating the script
If you installed globally:
sudo rm /usr/local/bin/connTo remove SSH connections data:
sudo rm /usr/local/bin/connTo remove SSH connections data:
rm ~/.ssh_connections.confContributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
If you have questions or need help:
- Open an issue on GitHub
- Check existing issues for solutions
MIT License - Free to use and modify.
Made with β€οΈ by Andrea Pollastri