6

I set the passphrase of my ssh key by mistake.

But it is annoying that putting the passphrase for every time using the key.

I'd like to remove the passphrase of my key with:

$ ssh-keygen -p -f <my/key/file>

I'm afraid of that, however, the key would be changed.

The job is seemed too danger to test since I use the key in several way.

The man page says, the command would not change the key I think, but it is uncertain:

-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.

2 Answers 2

6

Indeed, the passphrase is just a local protection for a private key file. From server-perspective, the key stays the same.

There's no danger for you in trying. Just backup your encrypted key before conversion.


Though the right solution is to use an authentication agent (like OpenSSH ssh-agent). With the agent, you type the passphrase only once, when loading the key into the agent.


If you want/need an unencrypted key for some automation, the right solution is to have two keys. One encrypted for interactive use and one unencrypted for unattended use. So that in case your unencrypted key is compromised, you can cancel it without a need to replace your encrypted one.

0
1

Another solution would be reset your password to a new one using ssh-agent and leave new password as an empty string

  1. Go to your .ssh folder via Terminal
  2. ssh-keygen -p
  3. Enter your current password
  4. Follow interactive screen and just keep pressing enter twice
1
  • 1
    This is what the OP wanted to try. OP was just asking if it is ok to do. Dec 1, 2018 at 13:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.