Ubuntu – Enabling passphrase on an already existing private key

command linessh

I already have a ssh private key without a passphrase. As I have started to use it to login to a few critical and secure systems, I need to use a passphrase on my RSA private key. How can I enable passphrase on an already existing private key? Also I want to know how to backup the private key before I enable passphrase, in case I mess up or forget the passphrase (only for some days until I can commit the passphrase to my memory).

Best Answer

You could use the -p option to ssh-keygen:

ssh-keygen -p -f /path-to/key-file

It will prompt for old and new passphrase. It will also prompt for keyfile (with suggestion) if you do not provide -f key-file option.

Related Question