OpenSSH Change a Passphrase With ssh-keygen command

ssh-keygen

$HOME/.ssh

~/.ssh

ls -l $HOME/.ssh/

ADVERTISEMENTS



Tutorial details Difficulty Easy (rss) Root privileges No Requirements OpenSSH Time 1m

How do I change OpenSSH passphrase for one of my private keys under Linux, OpenBSD, FreeBSD, Apple OS X or Unix like operating systems?You need to use thecommand to generates, change manages and converts authentication keys for ssh. You should the see following files atordirectory i.e. /home/you/.ssh/. You can use thecommand to see the following files:=>: DSA authentication identity of the user

=> id_dsa.pub : DSA public key for authentication

=> id_rsa : RSA authentication identity of the user

=> id_rsa.pub : RSA public key for authentication

Changing a Passphrase with ssh-keygen

The -p option 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. Use -f {filename} option to specifies the filename of the key file. For example, change directory to $HOME/.ssh. Open the Terminal app and then type:

$ cd ~/.ssh/

To change DSA passphrase, enter:

$ ssh-keygen -f id_dsa -p

To change RSA passphrase, enter:

$ ssh-keygen -f id_rsa -p

Sample outputs:



References

See ssh-keygen(1) man page for information on command line options.