How do you change ssh key passphrase?

Posted January 2, 2020 3.9k views
DigitalOceanUbuntu 16.04

We have a droplet which is using Ubuntu 16.04. We are logging via ssh. We need to change the passphrase.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer


To change the passphrase for your SSH key, you could use the following command:

ssh-keygen -p -f ~/.ssh/id_rsa

You will be asked to enter the old passphrase first followed by your new passphrase. The output would look something like this:

Enter old passphrase: ****
Enter new passphrase (empty for no passphrase): ****
Enter same passphrase again:                    ****
Your identification has been saved with the new passphrase.

Hope that this helps!

  • Under .ssh, i have only one file called Authorized_keys.

    It does ask me for a password but when i enter it, it gives me an error:
    Failed to load key /root/.ssh/authorized_keys: incorrect passphrase supplied to decrypt private key

    • I believe this is because the “rsaid” he’s referring to is the name of the ssh key (not the authorized keys file). As I recall, the tutorials refer to the rsaid file as the key itself (e.g.

      For example, if you named the key “MySSHKey”, you would run the command against that file (ssh-keygen -p -f /locationOfKey/MySSHKey). By default, if you name the SSH key, it goes into your home folder (~).

      Also, when you talk about the authorized_keys file, that should be on the server side. The SSH key should be on your client computer that you’re remoting in from.

      Hope this helps!