Linux system modifies SSH default port 22 to prevent brute force cracking and port blocking, VPS novice knowledge tutorial

888u

Last update at :2024-01-15,Edit by888u

In Linux/Uni Change port 22 to another random port number;

Of course, when using vps, you may often encounter situations where you need to modify the default 22 port of ssh. On the one hand, it is to prevent someone from maliciously brute force cracking the ssh password, and on the other hand, it is to solve the problem of port 22 being blocked;

How to know that SSH has been compromised

Check the SSH login log vim / var / log / auth.log. If a large number of authentication failures are found, your SSH port has been targeted and needs to be dealt with immediately

How to determine whether port 22 is blocked

If the IP of the VPS cloud server can be pinged, but cannot be logged in through SSH, it is most likely that the port is blocked. You can consider changing the SSH default 22 to another port

Modify SSH default port

vim /etc/ssh/sshd_config

Change Port to another port number

Restart the SSH service/etc/init.d/ssh restart

If it fails, you can try adding a firewall open port policy

Centos

firewall-cmd –zone=public –add-port=2010/tcp –permanent

firewall-cmd –reload

Ubuntu

iptables -A INPUT -p tcp –dport 2020 -j ACCEPT

service iptables save

You can use the http://coolaf.com/tool/port port scanning tool to detect whether the port is open

Recommended site search: Hong Kong server recommendation, asp host space, multi-ip station group server, Hong Kong free virtual host, view IP address, international domain name, cpanel space, Hong Kong hosting, PHP space purchase, US server,

Linux system modifies SSH default port 22 to prevent brute force cracking and port blocking, VPS novice knowledge tutorial

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码