ssh-keygen -p

Category: Security & Hardening

ssh-keygen -p

Change the passphrase of a private key

Prompts for the private key file, its current passphrase, and a new one, re-encrypting the key in place. The key itself is unchanged, so authorized_keys entries stay valid. Add a passphrase to any key that lacks one; it protects you if the key file leaks.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.