top of page

How To Generate SSH Key In Linux.

Updated: Oct 18, 2021

Let's start with understanding the need for an SSH key.


SSH keys are used by SSH servers to identify a user or device through public-key cryptography. SSH keys are made up of an alpha-numeric combination and are unique to the device to which they are assigned. At any time, authorized users can add, edit, or delete SSH keys.


How to create an SSH key on Linux Distribution.


Step 1: Generating SSH keys on the client machine for authentication.

The command used for generating an SSH key on Linux is "ssh-keygen".

This command generates 2 unique keys that are "id_rsa" and "id_rsa.pub". "id_rsa.pub" is the public key that has to be copied to the remote ssh server.



Step 2: Copying the public key to the remote server.

Firstly we have to go to the directory where we have saved the keys that is "/root/.ssh"

Now, we have to copy the public key to a remote server with the help of "ssh-copy-id <username>@<ip-aadress>".

The Username, as well as the IP Address of the SSH server, has to be mentioned in the above fields.


After executing the "ssh-copy-id" command the user will be prompted to give the Remote machine's password and after successful authentication, the public will be copied to the SSH server.


Step 3: Establishing connection to SSH server.

To connect the client machine to the SSH server we need to run "ssh <username>@<ip-aadress>" and you have to enter the paraphrase if you have mentioned it in Step 1 while generating the SSH key or else just press enter and you will be connected.

Now you have complete access to the SSH server machine.

Comentários


©2022 www.theblackthreat.in All right reserved.
bottom of page