How I manage my ssh connections
I was asked recently how I manage my ssh connections to various servers.
I'm copying my reply here:
First of all, I'm using a private/public key pair for all servers, no passwords anywhere. Ideally, my servers don't even allow logins with passwords.
- I keep my ssh private keys encrypted.
If you already have unencrypted keys, you can encrypt them with
ssh-keygen -f ~/.ssh/id_rsa -p. - I use a password manager to store the passphrase, so I only decrypt them once or they are automatically decrypted when I login to my computer. There's gnome-keyring for Gnome users and kwallet for KDE fans.
- I use
~/.ssh/configto save the ssh preferences for each server. eg:Host my-server HostName my-server.net User itsme IdentityFile ~/.ssh/id_rsa Port 22 - I just type
ssh my-serverorrsync -av <path> my-server:<path>. - Sometimes I use a shell (bash/fish) alias like
alias @my-server="ssh my-server". - I've also used
rofi.
It's an application launcher that supports ssh connections based on
~/.ssh/config.