Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of quickly modifying the remote Port of Linux Server

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

About the security port of some instructions, Linux remote port default 22, a lot of cracking machines, and so on simulation guess system is to default port 22 to simulate the port 22 is very dangerous, the following 56 cloud for everyone to bring is to modify the Linux default port method!

The first:01 If you want to change Linux SSH default port (22), then you only need to modify:/etc/ssh/sshd_config Port22, where 22 to set their own port on the line, but do not set and now have the same port Oh, in case of unknown consequences. 02 If you want to restrict SSH login IP, you can do the following: first: modify/etc/hosts.deny, add sshd:ALL to it, then: modify:/etc/hosts.allow, set the following settings in it:sshd:192.168.0.241 This will restrict I to only 192.168.0.241

The first:

01 If you want to change Linux SSH default port (22), then you just need to modify Port 22 in:/etc/ssh/sshd_config, where you change 22 to the port you want to set on the line, but do not set and now have the same port Oh, in case of unknown consequences.

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

First: modify/etc/hosts.deny to add sshd:ALL

Then: modify:/etc/hosts.allow to set it as follows:sshd: 192.168.0.241

This will limit the IP to 192.168.0.241 and log on to LINUX via SSH. Of course, as a server, I don't install gnome and KDE, and a lot of things are not installed, so increase the security factor.

Second:

Modify the configuration file first

vi /etc/ssh/sshd_config

Find the section #Port 22, here is the identifier default to use port 22, modified as follows:

Port 22

Port 50000

Then save exit

Execute/etc/init.d/sshd restart

This way SSH ports will work simultaneously with 22 and 50000.

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

Enable port 50000.

Execute/etc/init.d/iptables restart

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

The reason for setting up two ports first, and then closing one port after successful testing, is to modify the conf process, in case of unknown situations such as dropped, disconnected, misoperation, etc., can also connect through another port to debug to avoid connection must send people to the computer room, resulting in more complicated problems.

The above are several ways to modify linux ssh remote port content, more content, please use the upper right search function to obtain relevant information!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report