How do I change my private key passphrase?
To change the passphrase on your default key:
$ ssh-keygen -p
If you need to specify a key, pass the -f
option:
$ ssh-keygen -p -f ~/.ssh/id_dsa
then provide your old and new passphrase (twice) at the prompts. (Use ~/.ssh/id_rsa
if you have an RSA key.)
More details from man ssh-keygen
:
[...]
SYNOPSIS
ssh-keygen [-q] [-b bits] -t type [-N new_passphrase] [-C comment]
[-f output_keyfile]
ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
[...]
-f filename
Specifies the filename of the key file.
[...]
-N new_passphrase
Provides the new passphrase.
-P passphrase
Provides the (old) passphrase.
-p Requests changing the passphrase of a private key file instead of
creating a new private key. The program will prompt for the file
containing the private key, for the old passphrase, and twice for
the new passphrase.
[...]