Keys

Usage

Create a folder for the keys (if it doesn’t already exist):

mkdir ~/.ssh
chmod 700 ~/.ssh

To create your key:

ssh-keygen -o -a 100 -t ed25519

Note

Do not enter a password here.

Note

The old command line was ssh-keygen -t rsa. I updated on the advice of this article, Upgrade your SSH keys!

To add your key to the authentication agent:

ssh-add

To copy your key to a server (so you no longer need the password):

ssh-copy-id root@myserver

This command will simply copy your key to ~/.ssh/authorized_keys.

To append the key without an editor:

cat mykey.pub >> .ssh/authorized_keys

To copy the key to your clipboard:

xclip -sel clip < ~/.ssh/id_rsa.pub

Forward

To use SSH agent forwarding for example.co.uk:

ssh -A example.co.uk