How to Establish an SSH Connection to a GNU/Linux Server from GNU/Linux

In this tutorial, you will learn how to establish an SSH connection to a GNU/Linux server from a GNU/Linux client device. First, we will look at how to configure the private key on the client device, and then, we will look at establishing a connection to the server.

The SSH protocol allows you to establish an encrypted connection to a remote server via port 22. This enables you to administrate the server remotely using the command line interface as if you were physically in front of the machine.

 

How to establish an SSH connection to a GNU/Linux server from GNU/Linux

 

Before you get started:

 

To successfully complete this tutorial and establish an SSH connection to your GNU/Linux server, you will need:
  • To be registered on the Jotelulu platform and have logged in.
  • To have registered for a Servers or Remote Desktop subscription and have deployed at least one GNU/Linux server.
  • To have configured the SSH key on one of your GNU/Linux servers.

 

Part 1 – Configuring the private key on your GNU/Linux client

In the command line interface (CLI), you will first need to the folder ~/.ssh (1) and create a file in which to copy the private key obtained from the server (2). Then, you need to set read-only permissions for the user using the command chmod 400 (3).
The complete sequence of commands will be:
  • cd ~/.ssh
  • vi id_rsa
  • chmod 400 id_rsa

Part 1 - Run these commands on the GNU/Linux CLI to create the RSA file

Part 1 – Run these commands on the GNU/Linux CLI to create the RSA file

Part 2 – Connect to your GNU/Linux server from your GNU/Linux client

Once you have configured the SSH key on your GNU/Linux client device, you need to establish an SSH connection with the server.
To do this, run the following command:
ssh root@<SERVER_IP> -p <PORT> (3)
Where:
  • <SERVER_IP> is the public IP address of the server that you want to connect to.
  • <PORT> is the port that you will use for the SSH connection.

Part 2 - Run the command to establish an SSH connection

Part 2 – Run the command to establish an SSH connection

Conclusions and next steps:

Establishing an SSH connection with a server allows you to administrate it remotely using the CLI interface as if you were physically at the machine. As you can see in this tutorial, it is a very simple process that you can complete in just a few minutes.
If you found this tutorial useful and you would like to find out more about the features of this service, the following tutorials may also be of interest to you:
Hopefully, you won’t encounter any problems connecting to your GNU/Linux server using SSH, but if you do have any issues, please don’t hesitate to contact us so that we can help you.
Thank you for reading!

Categorias:Servidores