SSH Config Manager is a modern CLI tool built with Python to simplify the management of your SSH configuration file (~/.ssh/config). With this tool, you can easily add, list, search, edit, and delete SSH entries, all from the command line.
- Add SSH Entries: Add new SSH configurations with ease.
- List SSH Entries: Display all SSH entries in a clean table format.
- Search SSH Entries: Search for hosts by name or hostname.
- Edit SSH Entries: Modify specific fields of an existing SSH entry.
- Delete SSH Entries: Safely remove unwanted SSH entries.
- Verbose Output: View detailed information about each SSH entry.
- Modern CLI Design: Beautifully formatted tables with colorized output using
rich.
- Python 3.6 or higher
pip(Python package manager)
-
Clone the repository:
git clone https://github.com/zietbukuel/ssh-config-manager.git cd ssh-config-manager -
Run the Installation Script: Use the provided install.sh script to install the tool. The script automates the following steps:
- Makes the script executable.
- Copies the script to /usr/local/bin so it can be accessed globally.
- Installs the required Python dependencies (rich and sshconf) using pip. Run the script with the following command:
./install.sh
Note: If you prefer not to install dependencies via pip (e.g., because you want to use your system's package manager), you can skip dependency installation by passing the --skip-deps flag:
./install.sh --skip-deps
-
Verify Installation: After running the script, verify that the tool is installed correctly by checking the help message:
ssh-manager --help
If the installation was successful, you should see the available commands for managing SSH config entries.
The tool supports several commands for managing SSH config entries. Below are examples of how to use each command.
Add a new SSH entry to your ~/.ssh/config file.
python ssh_manager.py add <host> <hostname> <user> <port> [--identity-file <path>]Example :
python ssh_manager.py add myserver 192.168.80.204 root 22 --identity-file ~/.ssh/keyfile.keyDisplay all SSH entries in a clean table format.
python ssh_manager.py listFor verbose output (includes additional fields like IdentityFile):
python ssh_manager.py list -vSearch for SSH entries by host or hostname.
python ssh_manager.py search <query>Example :
python ssh_manager.py search myserverDisplay detailed information about a specific host.
python ssh_manager.py show <host>Example :
python ssh_manager.py show myserverModify a specific field of an existing SSH entry.
python ssh_manager.py edit <host> <field> <value>Fields : hostname, user, port, identityfile
Example :
python ssh_manager.py edit myserver user adminRemove an SSH entry from your ~/.ssh/config file.
python ssh_manager.py delete <host>Example :
python ssh_manager.py delete myserverSSH Config Entries
┌──────────┬─────────────────┬───────┬──────┐
│ Host │ Hostname │ User │ Port │
├──────────┼─────────────────┼───────┼──────┤
│ myserver │ 192.168.80.204 │ root │ 22 │
├──────────┼─────────────────┼───────┼──────┤
│ filesrvr │ 192.168.101.99 │ admin │ 22 │
└──────────┴─────────────────┴───────┴──────┘
SSH Config Entries
┌───────────┬─────────────────┬───────┬──────┬───────────────────────┐
│ Host │ Hostname │ User │ Port │ IdentityFile │
├───────────┼─────────────────┼───────┼──────┼───────────────────────┤
│ myserver │ 192.168.80.204 │ root │ 22 │ ~/.ssh/keyfile.key │
├───────────┼─────────────────┼───────┼──────┼───────────────────────┤
│ fileserver│ 192.168.101.99 │ admin │ 22 │ N/A │
└───────────┴─────────────────┴───────┴──────┴───────────────────────┘
Search Results for 'myserver'
┌──────────┬─────────────────┬───────┬──────┐
│ Host │ Hostname │ User │ Port │
├──────────┼─────────────────┼───────┼──────┤
│ myserver │ 192.168.80.204 │ root │ 22 │
└──────────┴─────────────────┴───────┴──────┘
Details for Host 'myserver'
┌───────────────┬───────────────────────┐
│ Field │ Value │
├───────────────┼───────────────────────┤
│ Hostname │ 192.168.80.204 │
│ User │ root │
│ Port │ 22 │
│ Identityfile │ ~/.ssh/keyfile.key │
└───────────────┴───────────────────────┘
This tool relies on the following Python libraries:
rich: For rendering beautiful tables and colored output.sshconf: For managing SSH config files.
Install them using:
pip install rich sshconfFor Arch Linux users, you can build and install this tool using the provided PKGBUILD file. This allows you to manage the installation via pacman or an AUR helper like yay.
-
Clone the Repository :
git clone https://github.com/zietbukuel/ssh-config-manager.git cd ssh-config-manager -
Build the Package : Use
makepkgto build the package:makepkg -si
-s: Automatically resolves and installs dependencies.-i: Installs the package after building.
-
Verify Installation : After installation, verify that the tool is available globally:
ssh-manager --help
Contributions are welcome! If you find a bug or have a feature request, please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Created by Juan Timaná.