Enhanced SSH host management and completion for Zsh with fzf integration.
- 🔍 Interactive host selection with fzf
- 📝 SSH config management (add/modify/remove)
- 🔐 Secure password storage with base64 encoding
- 🎯 Smart host completion with descriptions
- 📋 Detailed host information preview
- 🔄 Proxy command support
- 📦 Backup mechanism for config changes
Before installing zsh-ssh, make sure you have the following tools installed:
# macOS
brew install fzf
# Ubuntu/Debian
sudo apt-get install fzf
# CentOS/RHEL
sudo yum install fzf
# Arch Linux
sudo pacman -S fzf
# macOS
brew install gawk
# Ubuntu/Debian
sudo apt-get install gawk
# CentOS/RHEL
sudo yum install gawk
# Arch Linux
sudo pacman -S gawk
# macOS
brew install sshpass
# Ubuntu/Debian
sudo apt-get install sshpass
# CentOS/RHEL
sudo yum install sshpass
# Arch Linux
sudo pacman -S sshpass
Make sure you have installed all the required dependencies before proceeding.
zinit light sunlei/zsh-ssh
antigen bundle sunlei/zsh-ssh
-
Clone this repository into
$ZSH_CUSTOM/plugins
(by default~/.oh-my-zsh/custom/plugins
)git clone https://github.com/sunlei/zsh-ssh ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-ssh
-
Add the plugin to the list of plugins for Oh My Zsh to load (inside
~/.zshrc
):plugins=(zsh-ssh $plugins)
-
Start a new terminal session.
-
Add this config to
~/.config/sheldon/plugins.toml
[plugins.zsh-ssh] github = 'sunlei/zsh-ssh'
-
Run
sheldon lock
to install the plugin. -
Start a new terminal session.
-
Clone this repository somewhere on your machine. For example:
~/.zsh/zsh-ssh
.git clone https://github.com/sunlei/zsh-ssh ~/.zsh/zsh-ssh
-
Add the following to your
.zshrc
:source ~/.zsh/zsh-ssh/zsh-ssh.zsh
-
Start a new terminal session.
Press Tab after ssh
command to get interactive host selection with fzf.
sshadd
Interactive prompt to add a new SSH host configuration.
sshmod [hostname]
- Without hostname: Interactive selection with fzf
- With hostname: Directly modify specified host
sshrm [hostname]
- Without hostname: Interactive selection with fzf
- With hostname: Directly remove specified host
You can use #_Desc
to set description and #_Password
for encrypted password storage.
~/.ssh/config
# Development Server
Host dev-server
Hostname 1.1.1.1
User developer
#_Desc Development Environment
#_Password <base64-encoded-password>
IdentityFile ~/.ssh/dev-key
# Production Server
Host prod-server
Hostname 2.2.2.2
User admin
#_Desc Production Environment
Port 2222
ProxyCommand ssh -q -W %h:%p [email protected]
- Fuzzy search through all configured hosts
- Preview host details in real-time
- Color-coded descriptions
- Keyboard navigation support
- Passwords stored in base64 encoding
- Optional password authentication
- Secure password input (hidden)
- Jump server configuration
- Custom proxy commands
- Proxy user specification
- Automatic backup before modifications
- Timestamped backup files
- Config validation
- zsh
- fzf (required)
- gawk (required)
- base64 (usually pre-installed)
- sshpass (optional, for password authentication)