Accessing the Remote Server Using SSH Asymmetric Encryption

https://www.hostinger.com/tutorials/ssh-tutorial-how-does-ssh-work

This story is about accessing the remote Linux based server by using SSH Asymmetric Encryption. My aim here is not to explain the SSH architecture because I don’t want to dig a hole that has already been dug. Details about how SSH works and different encryption methods used are thoroughly explained in this article.

Guidelines

  1. Enable SSH on the server. Follow this tutorial to enable it.
  2. Generate an SSH key:
ssh-keygen -t rsa

You will be asked to inputs, it's your decision to fill them or not. In the image given below, I have not filled them:

Output once ssh-key is generated

The ssh-key generated below can be found in this folder

~/.ssh/

In the above image, it can be seen that two keys are generated a public and private key. Never share the private key and public key will be used later in this tutorial.

3. Now the administrator will access the remote server and add the public key in a file containing the keys for the authorized users. This file can be found on this path if doesn’t exist create one:

~/.ssh/authorized_keys

Now add the public key in this file, you pubic key will look like this:

public key

Once the key is added, the user can access the server.

4. The server can be accessed using the command given below:

ssh <user>@<ip>

in this above scenario, this command will look like this

ssh irti@<ip>

You should be able to access the server.

Final Thoughts

DevSecOps Engineer https://irtizaali.com/