What Is SSH? An Introduction to Secure Shell Protoco
SSH, Secure Shell, or Secure Socket Shell plays a fundamental role in the domain of secure remote access. Alongside RDP (Remote Desktop Protocol), SSH holds its place as one of the top protocols by providing seamless and secure interactions.
Essentially, SSH offers a robust and reliable protocol for establishing connections with remote servers and devices through a terminal. It stands as a protected gateway, enabling system and network administrators to achieve highly secure remote access to their equipment.
In this SSH tutorial, we will delve into the Secure Shell protocol, explaining the SSH meaning and how does it work. We’ll also guide you through the process of connecting to a remote Linux server using an SSH client, PuTTY.
Working of SSH: An Overview
Securely connecting to two remote servers using the SSH protocol involves two components: SSH client and SSH server. The client is the software running on your local device, while the server component runs on the remote machine.
Once a secure SSH connection is established, a shell session initiates, allowing you to interact with the server by entering SSH commands via the terminal from your local client machine, forward ports, and create tunnels.
Let’s discuss the working of SSH in detail.
How to Initiate Connection From SSH Client to Remote Server?
You can initiate a connection from the SSH client to the remote server in the following steps:
- Launch the SSH client on your local device and specify the remote host's IP address or domain.
- The SSH client verifies your credentials (username and password) and creates an encrypted connection to the remote host for secure data exchange.
- Ensure the SSH daemon is running on the remote server that listens to a specific TCP/IP port for incoming client connections and responds by sharing information about the software versions and supported SSH protocol versions—both the client and server exchange identification data.
- If the credentials are correct and the server accepts the connection, SSH establishes a secure session between the SSH client and the remote server machine. This initial handshake process is an important step in establishing a secure SSH remote control session.
By default, SSH protocol version 2 is used for enhanced security and modern communication. Next, let’s discuss what kind of encryption techniques are used while using SSH protocol.
Types of SSH Encryption Explained
SSH uses two different types of encryption techniques:
- Symmetric Encryption
- Asymmetric Encryption
Symmetric Encryption
Symmetric encryption is a method of encrypting data where a single secret key is employed for both encrypting and decrypting the messages. This means that the message being broadcast may be decrypted by anybody who has access to the key.
In this type of SSH encryption, the client and the server generate a secret key through a mutually agreed-upon process, and this key is never disclosed to any other entities.
Sometimes referred to as shared key or shared secret encryption, symmetric encryption typically involves a single key or, occasionally, a pair of keys. In the case of a key pair, one key can be easily derived or computed using the other key.
Asymmetric Encryption
Asymmetric encryption differs from symmetric encryption in that it employs two separate keys for encryption and decryption. These keys are known as the public key and the private key and work together to create a public-private key pair.
The private key is kept a secret, whereas the public key is freely distributed. In this encryption technique, anyone can use a public key to encrypt a message, but only the receiver, who also has access to their corresponding private key, can decrypt it.
The public and private keys are linked by complex mathematical processes, but the keys themselves are long strings of seemingly random numbers and symbols.
How to Enable SSH Connection on Linux?
To enable SSH connection on your Linux system, you will make sure that the client and server are configured on your local and remote servers.
Now, perform the following steps to enable an SSH connection on a Linux system:
Step 1: Install OpenSSH Client
Update system repositories and install the OpenSSH client if it is not installed on your Linux system:
$ sudo apt update $ sudo apt install openssh-client
The SSH client by default pre-installed on most of the Linux distributions.
Step 2: Install OpenSSH Server
To accept SSH connections, you will need to install an OpenSSH server on your Linux system. SSH server is not installed by default on Ubuntu 22.04. However, you can install the OpenSSH server from the Ubuntu apt repository and then enable the other SSH connections. Use the below command to install the OpenSSH server on a Linux system:
$ sudo apt install openssh-server
Step 3: Check the SSH Connection Service Status
Verify the SSH service running status using the ‘systemctl’ command:
$ sudo systemctl status ssh
The ‘systemd’ unit manages all services on Ubuntu distributions. Similarly, if you can manage the SSH service (start or stop an SSH service) with the following commands:
$ sudo systemctl start ssh $ sudo systemctl stop ssh
If the service is not running properly on your system, you can enable and restart the SSH service on your Linux system:
$ sudo systemctl enable ssh $ sudo systemctl restart ssh
Step 4: Allow Firewall UFW Access to SSH Port
Linux SSH connection listens at the port of 22. Therefore, allow the firewall UFW port settings to enable SSH for remote access configuration.
$ sudo ufw enable
Now, allow access to remote SSH connections at port 22 in the UFW firewall using the following command:
$ sudo ufw allow 22/tcp
Step 5: Connecting to SSH Server on Ubuntu 22.04
Once you enable SSH via the terminal, you make it to initiate the remote SSH connections and can accept the incoming SSH remote client connection requests. Use the ssh command to connect to the remote server:
$ssh user-name@IP-address/remote-hostname
For example, here, we will use the SSH command to connect to a server with an IP address (enter your IP address) as the user ‘hostname.’ Enter SSH via terminal:
Congratulations! Now, your server is ready to accept SSH remote connection requests from other SSH clients.
What is PuTTY?
PuTTY is an open-source terminal emulator. It is a free and cross-platform software that works for both Windows and Linux users.
As a popular SSH client, PuTTY acilitates secure connections to remote machines, irrespective of the underlying operating system. The primary function of PuTTY is to provide a text-based user interface to securely connect to remote servers. In this regard, it supports a range of protocols, including SSH, Telnet, rlogin, and SCP.
Using PuTTY, you can easily connect your Unix shell environments from Windows. Linux systems typically come equipped with built-in SSH command support, yet many Linux users still opt for the PuTTY application when establishing SSH connections with remote servers.
How to Install PuTTY on Linux?
PuTTY is not pre-installed on most of the Linux distributions. However, you can install PuTTY on the Linux system using the terminal.
If you don’t already have an installation of PuTTY on your Linux system, you can manually download it from its official PuTTY Download page. Here, you will need to select the Unix or Linux installer from the Package files.
Follow the below steps to install PuTTY on the Ubuntu 22.04 Linux distribution.
Step 1: Download and Install PuTTY using the Ubuntu Universe Repository
PuTTY is also available in the Ubuntu Universe Repository. So, you can also install it from there.
Here, we will install PuTTY on the Ubuntu 22.04 Linux system. Before starting the installation, make sure the Ubuntu Universe repository is added and enabled on your system.
Step 2: Add Ubuntu Universe Repository
First, add the Ubuntu universe repository using the following command:
$ sudo add-apt-repository universe
Step 3: Update System Repositories
Once the repository is added and enabled, it is recommended to refresh all system repositories using the below command:
$ sudo apt update
Step 4: Install PuTTY on Linux (Ubuntu 22.04)
Now, install PuTTY on Ubuntu 22.04 with the following command:
$ sudo apt install putty
Once you complete the PuTTY installation, you can start and use PuTTY on your Ubuntu system. You can launch PuTTY on Linux using the application search bar. Type ‘PuTTY’ in the search bar, and you will see the PuTTY application icon under the search results.
How to Connect to a Linux Server Using PuTTY?
Using PuTTY, you can connect to any remote server or machine. In this section, we will show you how to connect to a remote Ubuntu Linux server using PuTTY.
Step 1: Install PuTTY on Windows OS
- To connect to a remote Linux machine, you will install PuTTY on a Windows system. To install PuTTY on Windows, visit the official Download page. Select the .msi installer for Windows.
- Click on the installer to run on your system. First, the PuTTY setup wizard will launch on the desktop. Click ‘Next’.
- Select the destination folder. Here, we will proceed with the default installation and click ‘Next.’
- Now, click on the install to start the PuTTY installation on the Windows system.
- Once the installation is complete, click on ‘Finish’.
- Launch PuTTY on Windows from the start menu.
Step 2: Setup Remote Linux Server
In this guide, we will use Ubuntu 22.04 as a remote SSH Linux Server.
- Open your remote Linux server. It is assumed that ‘openssh-server’ is installed on your Ubuntu system, as we discussed above.
- Check the IP address of your Ubuntu system using the ‘ip a’ or ‘ifconfig’ command.
- Copy the remote server IP address and paste it into the PuTTY configuration on the Windows system. Now, leave all fields unchanged and click on ‘Open.’
- You will see the following ‘PuTTY Security Alert’ displayed on the desktop. Click on ‘Accept’.
- After that, a terminal window will appear on the desktop. Here, you will enter the remote server login name and password. Press enter, and the following window will display on the terminal:
- You have successfully connected to your remote Linux server using PuTTY. Run a few commands for verification:
- Now, open the Ubuntu 22.04 server and check these commands:
As we can see from the above screenshot, the folder is created on a remote Linux server. Now, cancel this window to close the session.
Conclusion
SSH is vital in today's digital era, ensuring encrypted, secure communications between devices. From understanding its intricate workings to initiating connections with remote servers, its significance is undeniable. Its adaptability in systems like Linux and accessibility through tools like PuTTY underscore its importance.
This guide has provided valuable insights into the process of accessing SSH remotely and leveraging its advantages. After all, as digital communication continues to grow, mastering SSH remains crucial for secure and reliable data exchange.
At Bluevps, we take pride in offering a variety of Linux VPS plans tailored to help you make the most of SSH's exceptional qualities. Our commitment is to deliver outstanding hosting experiences with high-quality Linux VPS solutions that prioritize security and performance.
Blog