@mh-nikbakht/ssh-manager-cli
v1.0.0
Published
A simple, cross-platform CLI tool for managing SSH connections. Store host details in a local SQLite database, securely manage passwords using your system's keychain (via keytar), and connect to hosts in your preferred terminal app. Supports interactive m
Downloads
117
Maintainers
Readme
SSH Manager
A simple, cross-platform CLI tool for managing SSH connections. Store host details in a local SQLite database, securely manage passwords using your system's keychain (via keytar), and connect to hosts in your preferred terminal app. Supports interactive mode for easy management and CLI commands for automation.
- Platforms: Primarily macOS and Linux. Windows is not fully supported (due to sshpass limitations), but you can use it with SSH keys or interactive passwords.
Features
Add, edit, list, and remove SSH hosts.
Secure password storage (using system keychain).
Non-interactive connections with stored passwords (requires sshpass).
Open connections in Warp, Terminal.app, iTerm (macOS) or common Linux terminals (e.g., GNOME Terminal, Konsole).
Install prerequisites like sshpass interactively or via CLI.
Interactive menu for user-friendly management.
Installation
From NPM (Recommended)
Install globally for CLI access:
npm install -g ssh-manager
This will make the ssh-manager command available in your terminal.
From GitHub
Clone the repository and install dependencies:
git clone https://github.com/yourusername/ssh-manager.git
cd ssh-manager
npm install
npm link # Links the CLI globally for testing
Prerequisites
Node.js: v14 or higher.
sshpass: For non-interactive password-based connections. The tool can install it for you on macOS (via Homebrew) or Linux (Debian/Ubuntu, RHEL/CentOS, Arch). Run ssh-manager install-prereq to install it.
Terminal Apps (macOS): Warp, Terminal.app, or iTerm2.
Linux Terminals: GNOME Terminal, Konsole, XFCE Terminal, or xterm (detected automatically).
Windows: Limited support. Use SSH keys or WSL for better compatibility.
Note: Password storage uses your system's secure keychain (e.g., macOS Keychain, GNOME Keyring on Linux). No passwords are stored in plain text.
Usage
Interactive Mode
ssh-manager
This opens a menu where you can list hosts, add/edit/remove, connect, manage passwords, set default terminal, and install prerequisites.
CLI Commands
Use ssh-manager --help for full details.
- List all hosts:
ssh-manager list- Add or update a host:
ssh-manager add <name> <host> [-u <user>] [-p <port>] [-w <password>]- If
-wis provided without a value, it prompts securely for the password. - Example: ssh-manager add myserver example.com -u myuser -p 2222 -w
- Connect to a host:
ssh-manager connect <name> [-t <terminal>]-t: Specify terminal (warp, terminal, iterm). Falls back to default if not provided.Uses stored password if available (non-interactive via sshpass).
Example:
ssh-manager connect myserver -t warpRemove a host:
ssh-manager remove <name>Set default terminal (macOS only):
ssh-manager set-terminal <terminal> # warp, terminal, or itermRemove stored password:
ssh-manager remove-password <name>Install prerequisites (e.g., sshpass):
ssh-manager install-prereq
Configuration
- Database: Stored at ~/ssh_hosts.db (SQLite).
- Passwords: Stored securely via keytar (system keychain).
- Default Terminal: Set via set-terminal command or interactive menu. Defaults to Warp on macOS or system default on Linux.
