Generated via Gemini and Grok.

ssh-keygen -t ed25519 -C "purpose_or_email" -f ~/.ssh/key_name
  • ed25519 — preferred (modern, fast, secure). Use rsa -b 4096 only for legacy compatibility.
  • -C — comment to identify the key (e.g. "work-github", "prod-server")
  • -f — explicit filename; don’t use the default id_ed25519 for 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_name

Permissions

chmod 700 ~/.ssh
chmod 600 ~/.ssh/key_name        # private key
chmod 644 ~/.ssh/key_name.pub    # public key

Rule 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