unique port

How can we change the default tcp port 22 of our SSH server on our Debian or Ubuntu Linux server for better security?

botond published 2022/10/23, v - 08:10 time
There are several ways to manage web servers and other servers remotely, of which SSH is the most common command line solution. The SSH protocol communicates over an encrypted channel between the server and the client. Like all similar communications, SSH transmits data through a specific port, which by default is the well-known tcp port 22. Since the function of this port is known to many people, it exposes the servers to regular attacks. This is usually avoided - or at least to reduce the number of attempts - by switching this well-known port to another, unknown port number, which can only be detected externally by port scanning, which is a more time-consuming task.
In this write-up, we will look at how to change SSH's well-known TCP port 22 to a unique port number to minimize the number of attack attempts via SSH.