Linux Commands

How to Use SSH: Establishing Remote Connection on Linux

“Linux stands out in its ability to remotely control computer systems using various commands. Notably, POSIX users can open and utilize a secure shell using the OpenSSH framework to access computers they are authorized to access.

Interestingly, they can do this from remote locations. Secure Shell is a network communication framework that enables communication and data sharing between two computers. It features impressive security and encryption features, making it ideal for unsecure network environments. Besides, it features a suite of utilities used to implement the protocol.

While establishing a connection between computers using SSH is routine for seasoned system administrators and Linux users, novice users will find it a bit challenging. This article solves this problem for you.”

How to Use SSH on Linux

Firstly, it is vital to note that the creation and development of SSH are aimed at replacing login programs or insecure terminal emulation such as rlogin (remote login), Telnet, and rsh (remote shell). While it enables the same functions, it comes with extra security features. Besides, it replaces File Transfer Protocol, remote copy, and other file transfer programs.

To create and enable an SSH connection, you will need two components—a host and a client. The host could be anything ranging from a router, a server, an IP address, a domain name, and any other relevant device/system. The server side will always have an SSH daemon that keeps listening to an established TCP/IP port for potential connection requests.

On the other hand, the SSH client is an application with a suite of utilities that you will install and set up on the computer. This client computer connects to a server or a host using a set of predefined information. A connection will only be successful once the credentials are correct and verified.

The SSH daemon on the server will respond with its supported protocol and software versions whenever a client requests a connection. The two systems will then exchange identification data for verification. SSH will create a new session based on the environment should all credentials or identification data be verified to be correct. The default SSH version for both server and client systems is version 2.

The summary of how SSH works lie in the following points;

  1. Client contacts the server to initiate the connection
  2. The server prepares and sends back a public key
  3. Both server and client negotiate open source channels with relevant parameters.
  4. The user logs in to the server host remotely.

Using SSH to Establish Connection Between Host and Client

Each device must have a functional installation of the SSH protocol to establish a connection between two computers. And from the local machine, you will use a command to initiate a connection to your host or server.

The following should help you through the process;

Step 1: Verify if Both Host and Client Command are Installed and Active

Check if your systems have all the relevant SSH files on both the server and client sides. You can use this command on the server side to confirm;

You can do the same on the client device using the below command;

Step 2: Install SSH If Missing on Either Side

The system can bring back a No such directory or No such file error. This error could occur on one or both devices. Note that this will only happen if you do not have SSH in your machine or system.

Thus, you will need to install SSH on the missing side or both sides using the following commands;

Install SSH on the server side using this command;

Install SSH on the client computer using this command;

Once installed, enable SSH on the remote computer to ensure it is active and running normally. You can activate your system using this command;

Step 3: Test Your Systems

You can test your systems by logging into your remote system using the local computer. But first, you should have an account with a username and password. Secondly, you must know the IP address or the unresolved hostname of the remote server.

If you do not know your remote server’s IP address, you can query your system for the IP address.

Step 4: Create a Connection to the Remote Server

You can proceed to create a secure shell by using the below command.

Use your username alongside your remote server’s IP address or hostname.

Conclusion

Understanding SSH will change your view of Linux computing and system administration. It gives you the flexibility to access remote computers; hence you will not confine yourself to the system in front of you only. Thus, you unlocking the potential of SSH unlocks the capabilities of the Linux terminal. The above steps should help you use SSH effectively.

Sources

About the author

Kennedy Brian

Brian is a computer scientist with a bias for software development, programming, and technical content development. He has been in the profession since 2015. He reads novels, jogs, or plays table tennis whenever not on gadgets. He is an expert in Python, SQL, Java, and data and network security.