What is SSH and what is it for?
What is the SSH protocol and what is it used for?
It is one of the protocols we have to connect remotely to a server. It is available for Linux and macOS, in addition to being able to use a client on Windows. It basically consists of being able to manage a server remotely, but also do it safely.
SSH uses an authentication system, which will provide the security that we mentioned. We can communicate two computers with each other, remotely, and that communication will be encrypted. For example, it is used to log into a computer remotely and use a username and password.
It works in a similar way to the Telnet protocol, but SSH appeared as an encrypted solution, to maintain security and avoid problems. It is based on 128-bit encryption, which ensures strong protection and makes it really difficult for an intruder to decrypt and read the data that is being sent or received. Telnet transfers the data in plain text and that is a problem.
Remotely connect to a server
The most important use of the SSH protocol is to connect remotely to a server. This can be graphical, as it would be a program in Windows, but also through the terminal, as for example in Linux.
We will always have to use the corresponding username and password since this protocol requires authentication. This is what will allow us to remotely access a server and be able to control it or carry out different actions without the need to be physically in front of it.
Update a device or make changes
Remotely and through SSH we will be able to update a device. For example, we can access a NAS to update to a new version of the firmware and send the files that are necessary for it.
We can also make changes to the configuration remotely. For example, install an application or even restart the device if there is an error. All this, once again, without the need to be physically in front of that device.
Modify or copy files
We can also send files from one computer to another through the SSH protocol. This means that we can be working from a computer, for example, and later upload those files to a server using this protocol.
In the same way, we can access a server and modify the files that already exist. This prevents us from having to download the files, modify them and then send them again. What we do is modify them directly on the server.
How SSH works
But how exactly does SSH work? It should be mentioned that you need three essential points: user, port, and server. This is what will allow us to establish a connection between servers and to be able to do everything that we have mentioned.
The standard SSH port assigned is TCP 22. However, that port can always be changed if we want. The SSH client will contact the server to initiate the connection. That server is listening through port 22 or whatever has been assigned to it. Later the server will send the public key and begin to organize the parameters and open a secure channel. The client logs in to connect to that server.
The server could be for example a web domain or an IP address. The user would be the name, such as root or administrator.
As for SSH encryption, there are different types. On one hand, there is symmetric encryption, which is the most popular, in which it uses a secret key that will be used both when encrypting and decrypting the connection. That key is unique.
On the other hand, there is asymmetric encryption, which this time uses two different keys. One key is public and the other private, and the information can only be obtained if the latter key is known.
A final encryption option is what is known as hashing. This is achieved by converting that information into a series of data that is unique.
How to use SSH in Windows
Keep in mind that Linux and macOS operating systems already have SSH incorporated. We can use the command line to access a server from Ubuntu, for example. But we will also be able to use it in Windows. We can install programs and take advantage of the operation of this protocol, although it will have to be enabled in the system.
For this, we will have to go to Start, write Services and open it. OpenSSH Server should appear there. In the event that this is not the case, we will have to enable it. We will have to go to Settings, enter Applications, Optional Features and Add a feature. We will have to click and click Install.
Whether we have had to install it or we already have it, we will have to go to Services and click on OpenSSH Server and click the second button. We will have to click on Start, although we can also configure it to always start with Windows.
Once we have this, we go to PowerShell and, with administrator permissions, we have to enable the listening port and for this, we must execute the following code.
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Service sshd -Enabled True -Direction Inbound -Protocol TCP -Action Allow -Profile Domain
We can now access this computer through the SSH protocol. The next thing will be to use a program for this purpose. The most used in Windows is Putty, which we can download and install for free.
In short, the SSH protocol is very useful to be able to access a computer remotely and also safely. It is an alternative to Telnet, notably improving security, and that we can use in our Windows system. It offers different uses, such as being able to send files, modify them directly on the server, update a computer, etc.