Changing Passphrase to your SSH Private Key

If you need to change or add a passphrase to your existing SSH private key just use ssh-keygen, the same tool which creates the key in the first place. Just add the -p option to specify you want to change an existing private key's passphrase instead of creating a new private key. So running this command will be changing the passphrase of the current user's private key, stored in ~/.ssh/:

ssh-keygen -p

If you have your key elsewhere and want to specify the file where it is then use the -f option followed by the path to the key file, and then the -p option:

ssh-keygen -f id_rsa -p

Just replace id_rsa with the path to your key file if you're not in the same directory as the file.

If you have an existing passphrase ssh-keygen will first ask you to enter that before allowing you to set the new passphrase, and if you haven't had a passphrase before then it will just allow you to set one.