Patrick Ward words, code, and music

SSH Cheatsheet

I’m always forgetting the commands needed to run ssh routines, so this is where I list them for easy reference.

Using SSH Agent to work with multiple ssh keys

I use multiple ssh keys for various projects and servers and sometimes need to make sure they are in the agent for quick access via ssh.

List currently loaded keys

ssh-add -l

Add a new key to the ssh agent list

ssh-add ~/.ssh/workid

Create a new SSH identity

ssh-keygen -f ~/.ssh/workid -C "workid"

SSH Config file

Host workid
HostName workserver.local
IdentityFile ~/.ssh/workid
Host personalid
HostName personalserver.local
IdentityFile ~/.ssh/personalid

Convert OpenSSL (SECSH) format to SSH-RSA (OpenSSH) format

This will read the public key in openssl format from and output it to OpenSSH format on stdout.

ssh-keygen -f -i