Changing the Default SSH Port
1. Log on to the server as an administrator.
2. Open the SSH configuration file sshd_config with the text editor vi:
1 | |
3. Search for the entry Port 22.
4. Replace port 22 with a port between 1024 and 65536.
5. Save the file.
6. Restart the service.
Ubuntu
1 | |
CentOS7
1 | |
To establish an SSH connection after this change, enter the following command:
1 | |
7. Set up automatic startup
1 | |
Changing the Default SSH Port
https://www.hardyhu.cn/2022/02/21/Changing-the-Default-SSH-Port/