What is SSH, and how does it work?
SSH is a network protocol that allows you to connect to a remote computer or a server securely. It is not a specific product but a set of rules instructing how the communication over a network should occur. You can use SSH directly from the terminal window on Unix-like operating systems (such as Linux or macOS). On Windows, you might not have it integrated by default. Thus, you might need to manage optional features and install OpenSSH (or PuTTY) manually. Typically, SSH is useful for remote management, terminal access, file transfers, and tunneling. It is not a highly beginner-friendly approach, but it can be beneficial to anyone due to the number of use cases.
What is SSH?
SSH (Secure Shell) is a set of rules governing communications between devices. Two components are necessary in this case:
- An SSH server, which is essentially the device or server you want to control and manage remotely.
- An SSH client refers to software using SSH protocol on the device from which you will connect to the SSH server.
Thus, SSH relies on the client-server principle. It establishes communication between a device running SSH-supported software and the SSH server. However, that is not all that this protocol does.
Back in the early stages of the internet, conducting communications between endpoints might have been enough. So, specialists used Telnet, a predecessor of SSH. The problem here was that the communication was not encrypted, meaning the information traveled in plaintext. It was possible to sniff out the whole session, including passwords or any other critical information.
The purpose of SSH was to essentially make these remote sessions secure. Therefore, the protocol made it possible to protect them by covering three main principles:
- Authentication. SSH confirms your identity before allowing you to take control over a device or server. The most common way of doing this is through . In this case, the SSH server (the device or server you want to control) will need to indicate that you can be trusted beforehand. It is also possible to implement password-based authentication, but it is less secure.
- Encryption. The protocol encrypts information traveling over a network to make it immune to anyone attempting to spy on it. They will see that the communication happens and potentially the length of packets. However, the actual messages will be unreadable.
- Integrity. SSH ensures that data transferred during the session remains unchanged. As an example, a third party could attempt to modify commands initiated via the client. It essentially prevents such alterations and guarantees that they reach the recipient in their original form.
Is SSH convenient to use for end-users?
There are quite a few scenarios where SSH can benefit users and system administrators. To name a few, the protocol is typically helpful for conducting secure remote logins, file transfers, remote commands, port forwarding, and access control. While you do not need to be a networking expert to use it, some technical background is necessary.
For instance, Windows RDP () is probably a familiar term to anyone dabbling in the remote-control sphere. Although SSH might appear to work on the same angle of managing devices remotely, it is actually completely different. For one, SSH is way more demanding. It won’t present a GUI, only a command line interface. For example, RDP will show the entire screen and allow you to perform any action you want. On the other hand, SSH has its limitations and might seem like a struggle to set up and use.
However, learning how to set up SSH can prove useful when you have multiple computer accounts on different machines. With SSH, you can safely connect to any of them, execute commands, or copy files between them. Developers of distributed applications will also find SSH crucial since they will need to communicate over a network. It can also improve the security of file transfers and work as an alternative to(PGP). Finally, SSH can also prove its worth through tunneling and port forwarding, which we would like to discuss next.
SSH tunneling and port forwarding
SSH essentially builds a secure tunnel to another computer that you then can control. However, in some cases, it can do much more, like granting you access or rights despite certain firewall restrictions.
- Local port forwarding. Imagine that you are at work or school and want to connect to your home computer. Unfortunately, networks in these institutions choose to block port 3389 (used for RDP). You can actually forward this RDP request through the SSH tunnel and to a different port (presumably one that is not blocked). Then, you should be able to use RDP and connect to the device you want.
- Dynamic port forwarding. This process will let you transform your client into a . Let’s assume that the network you connect to blocks certain websites due to the filter on port 80 (for web traffic). You can run a command through the terminal using a custom port and your home SSH server credentials to create the proxy. However, you will need to configure each program you want to use the SOCKS proxy manually. You will probably have no issue with this setup on, let’s say, browsers. But bear in mind that not all applications have proxy support.
The primary goal of SSH is not necessarily about forwarding network traffic. In most cases, it is about establishing more secure remote terminal sessions. However, SSH capabilities do help you manually prepare a SOCKS proxy and use it for tunneling traffic.
All in all, using SSH is something that will require some elbow grease and technical knowledge. If you are curious about this protocol, you will find many online resources helping you discover its true potential. While it is useful in many scenarios, you just need to find those relevant to you.