You need to use the ssh-keygen command to generates, change manages and converts authentication keys for ssh. You should the see following files at $HOME/.ssh or ~/.ssh directory i.e. /home/you/.ssh/. You can use the ls -l $HOME/.ssh/ command to see the following files:
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | OpenSSH |
Time | 1m |
=> 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.
🐧 14 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
If something relies on the private key will it still work the same way? I mean a SSL certificate for example…
thanx for the quick mem check
Thanks for this!
Thank applause and encouragement, for the valid reason that he offers me better power and courage!
change password key to best family ever
for newbie like me, I had to also add ‘ssh-add id-rsa’ to make it work. Very helpful tutorial
Thank you very much, its indeed a very helpful article
This is just what I needed. Thanks! And the animated gif demonstration was extra helpful. :)
Heya,
Thanks for sharing this useful information. It worked like a charm!
Just another thing, what tool did you use to capture the screen input to an animated GIF, please?
Thanks again,
Giovanni
Simple, objective and clean explanation.
Thank you so much!
Let’s say I want to give my SSH key used to access some servers to some else (e.g. because I’m not maintaining these servers anymore).
I can change the password as explained above and give “id_rsa” and “id_rsa.pub” to this person and he’ll be able to SSH on these servers without changing anything on the servers, right?
Yes, you can do that. Note there is no passphrase on the pub key.
Forgot my Passphrase, how to set a new Passphrase ?
Thank you, it was very helpful.