Publish: 2015-11-02 | Modify: 2015-11-02
What is the SSH port? In simple terms, it is the port used for remote connection to a Linux server, which is typically set to 22 by default. However, if your server is still using the default SSH port, you should be aware of potential risks such as port scanning and brute force attacks by malicious bots. If your password is also too simple, you may be vulnerable to these attacks.
This article explains how to change the SSH port on a Linux server. It is recommended that you modify the default port and avoid using port 22 for login. If you are concerned about security, you can also consider using key files for authentication, but this topic is not covered in detail here. You can find relevant documentation online if needed.
To change the SSH port, simply enter the command "vi /etc/ssh/sshd_config" to edit the configuration file. Look for the line "#Port 22" and remove the "#" symbol. Then, replace "22" with the desired port number and save the changes. Additionally, please be cautious about disclosing the port number to others.
After making the changes, restart the SSH service by entering the command "service sshd restart". From the next login onwards, you will need to use the modified port for SSH login. For example, if you have just changed the port to 2200, the screenshot below shows how to use it for login.
I come from China and I am a freelancer. I specialize in Linux operations, PHP, Golang, and front-end development. I have developed open-source projects such as Zdir, ImgURL, CCAA, and OneNav.