A collection of small handy ssh scripts

« Back to overview

These scripts are primarily aimed at OSX but are easily ported to other systems.

Enter all your passwords once for all your ssh keys

When using ssh-agent, it might be handy to enter all the passwords for your ssh keys only once (for example when booting up the computer), instead of looking up all the passwords when needed.

Create a script in your home directory with all your password protected keys
ssh-add ~/.ssh/id_ed25519
ssh-add ~/.ssh/id_rsa
# .. etcetera
make it executable:
chmod +x ~/ssh-add

Now, you can easily enter all your ssh keys in one go. Time saver!

Remove Offending key for IP / Matching host key

Changing servers and keys, and having annoying messages like:

Offending key for IP in /Users/***/.ssh/known_hosts:114
Matching host key in /Users/***/.ssh/known_hosts:126


Easily remove the offending line from known hosts by:

sed -i -e "${LINE}d" ~/.ssh/known_hosts