This note covers how to generate SSH keys, list public keys, and use a key to log in security.
Generate an SSH key
# Recommended: Ed25519
ssh-keygen -t ed25519 -a 64 -C "you@example.com"
# With a custom filename (in the current directory)
ssh-keygen -t ed25519 -a 64 -C "you@example.com" -f username
# RSA for legacy compatibility
ssh-keygen -t rsa -b 4096 -C "you@example.com"List existing SSH public keys
$ ls -l ~/.ssh/*.pub
-rw-r--r-- 1 user user 104 Dec 25 01:21 /home/user/.ssh/id_ed25519.pubLog in with a key
ssh -i ~/.ssh/id_ed25519 user@server