I have an existing public/private key pair. The private key is password protected, and the encryption may be either RSA or DSA. These keys are the kind you generate with ssh-keygen
and generally store under ~/.ssh
.
I'd like to change the private key's password. How do I go about it, on a standard Unix shell?
Also, how do I simply remove the password? Just change it to empty?
To change the passphrase on your default key:
If you need to specify a key, pass the
-f
option:then provide your old and new passphrase (twice) at the prompts. (Use
~/.ssh/id_rsa
if you have an RSA key.)More details from
man ssh-keygen
:If you don't have
ssh-keygen
installed, you can also useopenssl
directlyRemove your SSH public/private keys:
Recreate the keypair, choosing a new passphrase:
Add the newly created private key to your OS X Keychain to store the passphrase and manage unlocking it automatically:
Copy the public key to the OS X clipboard for adding to web services like GitHub, etc.
Add your newly created public key to the
~/.ssh/authorized_keys
file of the remote server. Be sure to ensure the correct permissions of both the remote~/.ssh
folder (700) and~/.ssh/authorized_keys
(600). You may want to investigate usingssh-copy-id
to ease this process.