Use a key like “ed25519”
ssh-keygen -t ed25519 -f <path/to/key>
print the public key:
cat <path/to/key>.pub
add your key(s) to authorized keys:
edit:
sudo nano ~/.ssh/authorized_keys
or copy directly:
cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys
or distribute your keys with ssh-copy-id
ssh-copy-id -f -i <path/to/your/key>.pub user@server
update your .ssh/config file
Host *
IdentitiesOnly yes
IdentityFile [path/to/new_file]
ForwardAgent yes
AddKeysToAgent yes
User <user>
chmod 700 ~/.ssh # the .ssh directory itself
chmod 600 ~/.ssh/* # by default all the files in .ssh
chmod 644 ~/.ssh/*.pub # change public key permissions
ssh-add -l
ssh-add -D
ssh-keygen -p -f <path-to-key>
from here:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem