How can I change the SSH port of my Linux server?

An optimized protection of a server also includes the change of the standard SSH port of a server. This change is the first step to prevent unauthorized access to your server.

To change the SSH port, please make the following changes to the system:

Open SSH configuration:

root@server:~# nano /etc/ssh/sshd_config

Change the corresponding line (replace port if necessary):

# What ports, IPs and protocols we listen for
Port 11111

Then restart the SSH server:

root@server:~# /etc/init.d/ssh restart

Now a connection to the standard port should no longer be possible the next time you log on to the system.
To connect to the server, the port must be specified. Under Putty this can be done via the field "Port". On Linux / Mac systems the specification is as follows (or comparable):

linux@home:~# ssh root@server -p11111

(Instead of 11111, enter the SSH port that has been changed at will.)

You cannot comment on this entry