Skip to content

andreapollastri/ssh-connection-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ‘Ύ SSH Connection Manager (conn)

Bash Platform License

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.

🎯 Quick Example

# Add a new connection
conn add

# List all your servers
conn list

# Connect to a server
conn to myserver

πŸͺ„ Installation

Method 1: Global Installation (Recommended)

Clone the repository from GitHub:

git clone https://github.com/andreapollastri/ssh-connection-manager.git
cd ssh-connection-manager

Run the installation script:

chmod +x install.sh
./install.sh

After installation, you can use the conn command from any directory!

Method 2: Direct Usage

If you prefer not to install globally:

chmod +x conn
./conn <command>

πŸ“‹ Commands Overview

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

⌨️ Available Commands

1. Add a New Connection

conn add

You 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): ********

2. List All Servers

conn list

Example 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

3. Show Connection Info

conn info <alias>

Shows detailed information about a specific connection.

Example:

conn info myserver

Example 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

4. Connect to a Server

conn to <alias>

Example:

conn to myserver

The 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

5. Edit a Connection

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 myserver

6. Remove a Connection

conn remove <alias>

You will be asked for confirmation before proceeding.

Example:

conn remove myserver

7. Reset SSH Keys

conn 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 myserver

8. Manage SSH Keys

conn key <action>

Available actions:

  • public - Show your SSH public key
  • private - 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 pair

9. Update Script

conn update

Downloads and installs the latest version from GitHub. Automatically uses sudo if the script is installed in a system directory.

10. Help

conn help

πŸ—„οΈ Configuration File

Connections 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.

πŸš€ Features

  • βœ… 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)

πŸ”§ Requirements

  • macOS (or any Unix-like system)
  • Bash
  • Git
  • SSH client installed
  • Optional: SSH key pair (id_rsa) - can be created with conn key create

πŸ“ Notes

  • 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 xclip or xsel (install if needed)
  • The script automatically checks for updates when connecting
  • Backups are created when updating the script

πŸ—‘οΈ Uninstallation

If you installed globally:

sudo rm /usr/local/bin/conn

To remove SSH connections data:

sudo rm /usr/local/bin/conn

To remove SSH connections data:

rm ~/.ssh_connections.conf

🀝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests

πŸ’¬ Support

If you have questions or need help:

  • Open an issue on GitHub
  • Check existing issues for solutions

πŸ“„ License

MIT License - Free to use and modify.


Made with ❀️ by Andrea Pollastri

About

A simple SSH connection manager for you Mac or Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages