creating ssh keys using ssh-keygen and copying to server

creating SSH Keys using ssh-keygen command in Ubuntu and centos linux machines

Creating SSH keys using ssh-keygen command on Linux :

We can create SSH key using ssh-keygen command in CentOS and ubuntu Linux system. Please use the following command to create your SSH private and public keys

Once you enter the above command, It will ask you for the keyphrase, Keyphrase adds an additional layer of security but if you want to make SSH or SCP through scripts then it is a good idea to leave it blank. Here i’m not using any keyphrase for simplicity.

Sample Output :

You can see your Public key and private key under your home directory ex : /root/.ssh folder

Moving SSH key’s to Server using ssh-copy-id command:

Run the following command to move your SSH key’s to your server.

Sample output :

 

Testing the SSH key:

Now, let’s try to log into the server using SSH.

Sample Output:

That’s it your successfully created SSH key’s and uploaded it into server.

Venkatesh

Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply