The SSH is mostly used to communicate between a local Linux machine to a remote Linux host, in this write-up, we will learn how to enable the SSH on the Raspberry Pi operating system.
How to install the SSH on Raspberry Pi
The Raspberry Pi is a Debian-based operating system, so the installation of SSH on Raspberry Pi is similar to any other Debian-based distribution. We will first, update the repository of the Raspberry Pi OS using the command:
After making sure all the packages are up to date, we will proceed towards the installation of the SSH. The SSH is usually pre-installed on Raspberry Pi but if it is not installed, then we can install it using the command:
The SSH protocol has been successfully installed.
How to enable the SSH protocol on Raspberry Pi
After the installation of the SSH protocol, we will validate the status of the SSH protocol by using the command of systemctl:
The service is in running status, so we will enable it by using the command:
The service of the SSH has been enabled and in the same way, make sure the SSH is installed and enabled on the machine you are going to access.
How to connect the remote machine using the SSH in Raspberry Pi
To connect with the remote machine, we first should know the IP address of that machine. To know the IP address, simply run the command mentioned below:
The IP address of remote machine is 192.168.18.154 and the general syntax of connecting with the remote machine using SSH is:
In the above syntax, using the ssh keyword we can connect any machine, for example, in our case, “pi” is the user and 192.168.18.154 is the IP address of that user. We will use the command in our machine’s terminal:
When you are connecting to any machine first time, it will ask permission for proceeding the connection with this newly Linux machine, allow it by typing “yes”:
It will ask the password, enter the password of the user, just provide password of the machine you are accessing:
List down the contents of the remote machine in order to verify the connection:
We can terminate this connection with the client machine through ssh by using the command:
Conclusion
The SSH also known as Secure Shell Protocol which is used to access the remote machine for various purposes, such as managing and maintaining the servers. It is much more secure compared to telnet. Since Raspberry Pi OS is a Linux based operating system, we can install and configure SSH on it quite easily. In this write-up, we have discussed the method of installation of the SSH in Raspberry Pi and also learn the procedure to make SSH enable in Raspberry Pi.