Removing Passphrase From SSH Key

So generally speaking it’s always preferable to use a passphrase with your SSH Keys, however there are times when a passphrase may get in the way, particularly with service accounts that run cron jobs or connect out to other servers in your environment. Rotating keys semi-frequently would be a wise security precaution to prevent your key from becoming compromised. That said lets go through the process of stripping out the passphrase from an existing key.

Remove Passphrase From Key

openssl rsa -in ~/.ssh/id_rsa -out ~/.ssh/id_rsa_nopass

This will create a new copy of your key without a password

 

Modify Permissions Remove Old Key

First we need to remove the old key and rename the new one

rm id_rsa
mv id_rsa_nopass id_rsa

Now we need to fix permissions:

chmod 600 id_rsa

Leave a Reply

Your email address will not be published. Required fields are marked *

14 + 7 =