|
The first type: 01 If you want to change the default port (22) of Linux SSH, then you only need to modify Port 22 in /etc/ssh/sshd_config, here you can change 22 to the port you want to set, but don't set it to the same port as the existing one, to prevent unknown consequences. 02 If you want to restrict SSH login IPs, you can do the following: First: Modify /etc/hosts.deny and add sshd:ALL to it Then: Modify: /etc/hosts.allow, where you can set the following settings: sshd:192.168.0.241 This restricts only 192.168.0.241 IPs from logging in to LINUX machines via SSH. Of course, as a server, I don't install gnome and KDE, and many dongdong don't install it, so as to increase the security factor. Second: First modify the configuration file vi /etc/ssh/sshd_config Find the #Port 22 paragraph, here is the default use of port 22, modified to the following: Port 22 Port 50000 then save and exit Perform /etc/init.d/sshd restart so that the SSH port will work with 22 and 50000 at the same time. Now edit the firewall configuration: vi /etc/sysconfig/iptables 50000 ports are enabled. Perform /etc/init.d/iptables restart Now use the ssh tool to connect port 50000 to test if it is successful. If the connection is successful, edit the sshd_config settings again and delete the port22 inside. The reason why it is set to two ports first, and then one port is closed after the test is successful, is to modify the conf, in case there is an unknown situation such as disconnection, network disconnection, misoperation, etc., you can also connect to another port to debug to avoid the need to send someone to the computer room to avoid the connection failure, resulting in more complex and troublesome problems.
|