The default SSH port number for each CentOS release is 22. to improve security, you need to modify the default SSH port number to prevent the password from being compromised. Some VPS providers may be fined or temporarily terminate services if your VPS server SSH has been cracked for multiple times. Therefore, it is necessary to modify the default SSH port. Some friends do not know what it means. here, we will show these friends the method of brute force cracking.
The default SSH port number of each CentOS release is 22 by default. if it is used for other purposes, you need to modify the default SSH port number to improve security.Brute force password. Some VPS providers may be fined or temporarily terminate services if your VPS server SSH has been cracked for multiple times. Therefore, it is necessary to modify the default SSH port.
Some friends do not know"Poor lifting"What does it mean? here we will give these friends literacy:
Brute-force password cracking is a method used to decrypt a password, that is, calculate the password one by one until the real password is found. For example, a password that is known to be a four-digit password and all composed of numbers may have a total of 10000 combinations, so you can find the correct password at most 10000 attempts. Theoretically, this method can be used to crack any password. The problem is only how to shorten the test time. Therefore, some people use computers to increase efficiency, and some use dictionaries to narrow down the password combination. For details, see Baidu Encyclopedia:Exhaustion
To put it bluntly, log in through the current SSH port (default: 22.
1. modify the configuration file:/etc/ssh/sshd_config and find # port 22 ()
2. remove the # sign before Port 22 and start another line. If the SSH port number is 26611, enter
Port 26611
We recommend that you set the custom port to a port of bits (for example, between listen-65535)
Maybe you want to ask why to remove the # before port 22 first? Because in the configuration file, # is a LinuxComment character. The code program after the annotation character is not executed. The default SSH port (not manually specified) is 22, so the configuration file is annotated by default. When you need to specify other ports or multiple ports for simultaneous access, you need to delete the annotator to inform the program to perform the response operation as you wish.
In the preceding operations, manually specify the SSH ports as 22 and 26611 (dual port number). retain 22 to prevent other ports from being blocked by some firewalls from connecting to the VPS (if 22 is not specified separately, the newly specified port 26611 firewall is not allowed, so it may not be able to connect to the VPS or server through SSH ). In order to prevent unnecessary problems, you need to keep a "back-to-back" for yourself ".
3. after modification, restart the SSH service and exit the SSH port of the current connection. ()
service sshd restart
4. after the restart is completed, try to use the new port to log on ()
Connection successful, you need to re-add SSH-RSA verification, click Yes (or Yes.
5. if the access is normal, return to step 1, delete the entire segment of the original port 22 according to step 2, and then restart SSH in step 3.
After the preceding steps are restarted, the default port 22 cannot be used to access SSH.