Two ways to modify the Linux system 22 first port of

  
:

01 If you want to change the default SSH port (22), then you just modified: /etc /ssh /sshd_config in Port 22, where the 22 change to the port you want to set up, but do not set the same port as the existing one, in case of unknown consequences.

02 if you want to restrict SSH login IP, you can do the following:

first: Modify /etc/hosts.deny, in which the addition of sshd: ALL

then: modify: /etc/hosts.allow, in which the following settings: sshd: 192.168.0.241

so that you can limit the IP 192.168.0.241 only landing on the LINUX machine via SSH. Of course, as a server, I don't have gnome and KDE installed, and many don't install it, which increases the security factor.

second:

first modify the configuration file

vi /etc /ssh /sshd_config

find #Port 22 period, here is the logo used by default 22 port, modified as follows:

Port 22

Port 50000

Then save and exit

Execute /etc/init.d/sshd restart

This SSH port will work on both 22 and 50000.

Now edit the firewall configuration: vi /etc/sysconfig/iptables

Enable 50000 port.

Execute /etc/init.d/iptables restart

Now use ssh tool to connect to port 50000 to test whether it is successful. If the connection is successful, edit the sshd_config settings again and delete the Port22 inside.

reason why the first set to two ports, a port and then turn off the test is successful, is to modify the way in conf process, in case of dropped calls, off net, misuse and other unknowns time, also It can be debugged through another port connection to prevent the connection from being sent to the computer room, which makes the problem more complicated and troublesome.
Copyright © Windows knowledge All Rights Reserved