set up an ssh key

Make a key, put it on a server to log in without a password, use a given key, change its passphrase.

networksecurity

steps
  1. ssh-keygen -t ed25519

    make a key pair in ~/.ssh; the passphrase protects it

  2. ssh-copy-id NAME@host

    put the public key on the server

  3. ssh -i ~/.ssh/work_key NAME@host

    log in with a given key

  4. ssh-keygen -p -f ~/.ssh/id_ed25519

    change or remove its passphrase

  5. GIT_SSH_COMMAND='ssh -i ~/.ssh/work_key' git clone git@github.com:org/repo.git

    use a given key for git

  6. chmod 600 ~/.ssh/id_ed25519

    "permissions too open": only you may read a private key

notes
  • Hosts and keys can go in ~/.ssh/config: Host work, HostName, User, IdentityFile.
  • Share only the .pub file; the other one stays on your machine.
commands used

ssh-keygenssh-copy-idssh

Each has a page in lore: lore ssh-keygen opens it.