How to add or remove passphrase on SSH key
You can add or remove passphrase for your SSH
private keys after creating your key pairs without creating a new key pair by using any of the following methods;
-
Interactive
ssh-keygen
$ ssh-keygen -p Enter file in which the key is (/home/user/.ssh/id_rsa): Enter new passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved with the new passphrase.
-
Inline
ssh-keygen
$ ssh-keygen -p -P old_passphrase -N new_passphrase -f /home/user/.ssh/id_rsa Your identification has been saved with the new passphrase.
-
openssl
$ openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_new Enter pass phrase for /home/user/.ssh/id_rsa: writing RSA key