Generated via Gemini and Grok.
ssh-keygen -t ed25519 -C "purpose_or_email" -f ~/.ssh/key_nameed25519— preferred (modern, fast, secure). Usersa -b 4096only for legacy compatibility.-C— comment to identify the key (e.g."work-github","prod-server")-f— explicit filename; don’t use the defaultid_ed25519for everything
Naming Convention
~/.ssh/
├── github_personal # private
├── github_personal.pub # public
├── prod_server_aws
├── prod_server_aws.pub
└── config
Name by purpose, not by type.
Always Set a Passphrase
Use ssh-agent so you don’t retype it constantly:
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/key_namePermissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/key_name # private key
chmod 644 ~/.ssh/key_name.pub # public keyRule of thumb: private = 600, directory = 700, public = 644
600: Only you can read/write
644: You can read/write, others can only read
700: only you can read/write/enter the directory- Create separate keys for work and personal accounts
github
Use Mosh Rather than ssh
Proxy Server using SSH