Theme editor

Guide Linux Changing the SSH Port in Linux

Kreathex

I love this place!
Corporate User
Thread owner
Since the default SSH port is 22, it can pose a security risk. If you want to change it, first log in to your server via SSH, then:

Code:
nano /etc/ssh/sshd_config

use the following command to open the file containing the SSH settings.
Inside this file, you’ll find a line specifying the port, as shown in the image below.

1762283939231.webp


Change the line #Port 22 to any number you prefer and will remember, then press CTRL + X to save the changes.

Example: Port 5789

After that, restart the SSHD server.

Code:
/etc/init.d/sshd restart
 
Back
Top