How to find or generate a SSH key on Linux system
To find or generate a SSH key on Linux system
-
Check for existing SSH keys on your computer. Skip to Step 4 if you already have one and want to use that one.
First, we will check for existing ssh keys:
$ cd ~/.ssh -
Backup and remove existing SSH keys to create one.
If there is already a SSH directory you’ll want to back the old one up and remove it.
$ lsLists all the subdirectories in the current ssh directory$ ls
config id_rsa id_rsa.pub known_hostsMake a subdirectory called “key_backup” in the current directory
$ mkdir key_backupCopy the id_rsa and id_rsa.pub files into key_backup
$ cp id_rsa* key_backupRemove existing SSH directory and key.
$ rm id_rsa* -
Generate a new SSH key. To generate a new SSH key, enter the code below. We will create new key in the current directory so when asked to enter a file in which to save the key, just press enter.
$ ssh-keygen -t rsa -C "your_email@youremail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):<press enter>Now you need to enter a passphrase.
Enter passphrase (empty for no passphrase):<enter a passphrase>
Enter same passphrase again:<enter passphrase again>Which should give you something like this:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:12:a1:7d:f2:64:9d:f0:a2:db user_name@username.com
The key's randomart image is:+--[ RSA 2048]----+ | .+* +o. | | . +EXo | | O.=o| | +o=o.| | S oo .| | . . | | . | | | | | +-----------------+ -
Go to the location where your SSH key is saved and open it
$ gedit /root/.ssh/id_rsa.pubEverything in this file is your SSH key. It looks something like,
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDNG2SI+C7y4KvCwR2YC2vFmmHCrHkMulfzfZRxbY+Yp2SxbUG4umBuk7aRp+5A1/8fvEA9WTY0z+E+7M10y6108HnjXqF7j+9cRlVqdaaroW9T6xz3C5efHLTuhSfGtYJ1BGprrnhsBWSPC2JKB6zK9RZ7pIXXAUbIyHaokcgcs7xofAqLoeLdE2ER9HmrZTj17wELHsJzztB4jJBGr4wWXTcb82gbb0B12nkbATpTzYVtlpLT1PnlJLsoNuvw3ZGwx8GmMWulOFFL7IfrT0tbajKZfvlXT22Y1Wixuq3YFjltS5OQjgPC4LQTeWb+qvB2Lj6mrvJsVCeOkKmGrZ/J
your_email@youremail.com
Possibly Related posts:
- Finding files using ‘find’ command in Linux
Here’s a list of most useful linux “find files” commands i have summarized recently. Finding files with filename Find file by exact name $ find... - Delete SVN files in Linux or Windows
Sometimes you checkout a recent API source code via some SVN client to your local system and thereafter want to remove SVN files from the... - Creating new virtual hosts in Ubuntu/Linux
In KUbuntu i wanted to make virtual host localhost.example.com working on my local machine what it worked like on Windows 7 earlier. I am posting... - “Warning: session_start() [function.session-start]: open(/tmp…”, a possible fix for oscommerce
For the following warning in oscommerce installation: Warning: session_start() [function.session-start]: open(/tmp\sess_5616cfa91211a8ef5ee94d09d21f7eb5, O_RDWR) failed: No such file or directory (2) in C:\wamp\www\catalog\includes\functions\sessions.php on line 67 As...
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.





