Objek Sinulingga

How to Generate New SSH Key on Linux ?

Welcome to my my Blog … this time i try to write in English smiley. Before you generate a new an ssh key to use for an authentication on github, cpanel hosting or another project, you can check for existing SSH Keys on your pc or laptop. What i am talking here is how to generate SSH Keys On linux

Checking for existing SSH Key >> Open Terminal

ls -al ~/.ssh
# If they exist, it will shows list the file in your .ssh

Example:

-rw-------  1  3326 Mei 20 20:42 id_rsa
-rw-r--r--  1 754 Mei 20 20:42 id_rsa.pub

Let’s Create A new SSH Key via Command Line

So Now.. if You dont' have an SSh Key on your Komputer , let’s generate a new SSH Key.

Open Terminal

ssh-keygen -t rsa -b 4096  -C "your _email@example.com"
# Creates new ssh key, by using the provided email as a label
    # in the example above, a 4096 bit RSA key.
Generating public/private rsa key pair

Than press enter to the deafult location of your key

Enter a file in which to save the key (users/you/.ssh/id_rsa): [Press Enter]
# You can modify a file in which to save the key example: (users/you/id_rsa_myproject)
# You can generate more than one SSH Keys by modifying it

Now you can insert a secure passphrase/Password

Enter passphrase/Password (empty fo no passphrase): [Type passphrase]
Enter same passphrase again: [Type same  passphrase again]

Adding SSH key to the ssh-agent

eval "$(ssh-agent -s)"
Example Agent pid 58522

Than type this to save ssh key :

ssh-add ~/.ssh/id_rsa
# Your identification has been saved in id_rsa
# Your public key has been saved in id_rsa.pub
The key finger print is d0:d6:c7:ec ..... bla...bla 

How to open your Public key ?

cat ~/.ssh/id_rsa.pub

That’s All smile…. now if you have project on github you can put them there… by opening profile >> settings >> SSH and GPG keys

Note: reference >> github

DMCA.com Protection Status