Appearance
How to rotate SSH keys
When
- Key material may be compromised
- Device lost / operator offboarding
- Scheduled hygiene
Steps
- Generate a new ED25519 key on the client (not on the server):bash
ssh-keygen -t ed25519 -a 100 -f ~/.ssh/id_ed25519_aux_$(date +%Y%m%d) -C 'ty@device-rotated' - Install the new public key on aux for
tywhile you still have working access:bashssh-copy-id -i ~/.ssh/id_ed25519_aux_YYYYMMDD.pub ty@147.93.186.68 - Verify a new session using only the new key:bash
ssh -i ~/.ssh/id_ed25519_aux_YYYYMMDD -o IdentitiesOnly=yes ty@147.93.186.68 'echo ok' - Remove old public keys from
~ty/.ssh/authorized_keyson aux (keep at least one known-good key). - Update fleet
~/.ssh/configand the SSH host inventory. - Revoke the old private key everywhere it was stored.
Host policy notes
- Root:
PermitRootLogin prohibit-password; no root authorized_keys in baseline docs. - Prefer finishing with
PasswordAuthentication noonce key mesh is verified (SSH reference).