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

What are the basic settings of the CentOS system?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What is the basic setting of the CentOS system? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

1. Modify the ssh remote port to 12345 and verify that you can log in with port 12345.

Use Putty remote tools to connect to the Centos6.9 system installed by the virtual machine

The ssh remote configuration file for Centos systems is generally stored in the sshd_config file in the / etc/ssh directory.

Use the vi / etc/ssh/sshd_config command to edit the file to find the line Port 22

Remove the # and change it to Port 12345.

Exit edit mode and restart the ssh service using the service sshd restart command (note that if the system has a firewall on before restarting the ssh service, you need to release the port. There is a release tutorial in the second question of this article)

Close the Putty tool, reopen the Putty connection, and change the login port to the modified 12345.

two。 Set up the CentOS firewall and pass through ports 12345 and 3306 of tcp, only one rule can be set.

The Centos firewall configuration file is stored in the iptables file under the / etc/sysconfig/ folder

Use the vi command to edit the file

Add a line of rules to release ports 12345 and 3306:

-An INPUT-m state-- state NEW-m multiport-p tcp-- dport 12345 3306-j ACCEPT

Restart the firewall service iptables restart after saving

How to use the port for Centos7 or above:

Enter firewall-cmd-- add-port=12345/tcp-- add-port=3306/tcp-- permanent directly on the command line

The success prompt indicates that it has been added successfully. You can use firewall-cmd-list-port to view the ports passed through.

Use firewall-cmd-reload to reload firewall rules to make them effective

3. Close SELINUX in the configuration file and take effect without rebooting the system.

Use the setenforce 0 command to turn off selinux, and use getenforce to view selinux status

Setenforce 0 closes selinux firewall. It will expire after reboot. It is used to temporarily shut down SElinux. Permanent shutdown requires modification of its configuration file.

The Selinux configuration file is stored in the config file under the / etc/selinux folder

Use the vi command to edit the file and find the red line

Modify to

Save and exit after modification. This method needs to restart the system to take effect.

The answer to the question about the basic setting of the CentOS system is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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