SSHConn is a Bash script that simplifies the management of SSH connections. It allows you to store, list, and manage SSH connections based on domain, username, and IP address. You can also group connections by server, add new connections, and perform SSH connections directly by specifying a domain.
- List Connections: Display a numbered list of stored SSH connections.
- Group by Server: View connections grouped by their IP address.
- Add New Connections: Easily add new SSH connection entries.
- Connect Automatically: Run
sshconn [domain]to automatically SSH into a server. - Secure Copy (SCP) Files: Use the
--scpoption to securely copy files to a server. - Edit or Delete: Edit or delete existing connections.
- Help Menu: A built-in help menu to display usage instructions.
You can easily install the sshconn script using curl or wget by following the instructions below:
# Download the script
curl -L https://raw.githubusercontent.com/mwender/sshconn/main/sshconn.sh -o /usr/local/bin/sshconn
# Make the script executable
chmod +x /usr/local/bin/sshconn# Download the script
wget https://raw.githubusercontent.com/mwender/sshconn/main/sshconn.sh -O /usr/local/bin/sshconn
# Make the script executable
chmod +x /usr/local/bin/sshconnOnce installed, you can start using the script by running:
sshconn -hThis will display the help menu with available options.
-
List all connections:
sshconn --list
-
Group connections by IP:
sshconn --by-server
-
Add a new connection:
sshconn --add
-
Connect to a domain:
sshconn [domain]
-
Securely copy files using SCP:
sshconn [domain] --scp
To enable autocompletion for the sshconn command, follow these steps:
Download the autocompletion script to your local machine:
curl -L https://raw.githubusercontent.com/mwender/sshconn/main/sshconn-completion.sh -o ~/.sshconn-completion.shFor Bash users, add this line to your ~/.bashrc (or ~/.bash_profile if you're using macOS) to enable autocompletion every time you open a new terminal:
source ~/.sshconn-completion.shFor Zsh users, add this to your ~/.zshrc:
source ~/.sshconn-completion.shAfter making the changes, apply them by running:
source ~/.bashrc # For Bash users
source ~/.zshrc # For Zsh usersNow, when you type sshconn and press TAB, it will autocomplete available domains based on the entries in your ~/.connections file.
1.2.0
- Added SCP functionality via the --scp option, allowing secure file transfers.
- Added autocompletion for file paths when using SCP.
1.1.3
- BUGFIX: Ensuring
--addoption adds new entries on a new line inside~/.connections.
1.1.2
- Adding "Behind the Code" section to README.
1.1.1
- Adding repo thumbnail.
1.1.0
- Adding auto complete function.
1.0.0
- First release.
I developed SSHConn with the help of ChatGPT 4o. The program builds upon my previous script sshman.
Being no expert in Bash, I was the project manager while ChatGPT wrote code according to my specifications. I set the direction and defined the features. ChatGPT worked as my junior developer, helping me implement the functionality and refine the code.
The result is SSHConn, a tool that improves SSH connection management. It adds features like autocompletion and connection grouping, making it more efficient than my original sshman script. Given that I have 200+ SSH connections I need to keep track of, SSHConn greatly simplifies that process.
This project is licensed under the MIT License.