Skip to main content

ssh: generate a key

Assume you will ssh from machine A to B.

On machine A

Go to .ssh:

cd ~/.ssh

Generate your key. Name it like id_TO_FROM_TYPE:

ssh-keygen -t ed25519 -f id_B_A_ed25519

Remember the passphrase in ssh agent (just for comfort):

ssh-add id_B_A_ed25519

Copy the public key to clipboard:

cat id_B_A_ed25519.pub | pbcopy

On machine B

Edit authorized_keys:

vim ~/.ssh/authorized_keys

Append your clipboard and save.