Quick and advanced guide to Linux Server Installation Security

Source: Internet
Author: User
Article Title: quick and advanced guide to Linux Server Installation Security. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

What measures should be taken immediately after the Linux server is installed to enhance the security of the server. These methods are also applicable to other Linux releases or versions.

◆ 1. disable unnecessary services

Linux services are divided into two types: one is started by the inetd super server, such as ftp and telnet. For these services, the system does not always run telnetd, ftpd, and other service processes. Instead, the inetd process listens to the service ports of these services. Once a service request arrives, it starts the corresponding service process (such as telnetd) to provide services. The other is an independent server, and the system has been running a corresponding service process.

The methods for Disabling these two services are different. For inetd-enabled processes:

The configuration file of the inetd super server is/etc/inetd. conf, which indicates which service requests should inetd listen to and start the corresponding services during the request. Therefore, you only need to edit/etc/inetd. the conf file can be used to disable services that are not needed. For example, to disable the pop3 Service, edit/etc/inetd. before the conf file, the file contains the following content:

Pop-3 stream tcp nowait root/usr/sbin/tcpd ipop3d

To disable the pop3 Service, add a annotator before the row:

# Pop-3 stream tcp nowait root/usr/sbin/tcpd ipop3d

By editing this file, you need to restart the inetd super server after disabling unnecessary services (for example, I only open telnet and ftp services in my system. First, find the inetd process Number:

[Root @ aid/etc] # ps ax | grep inetd

358? S 0: 00 inetd

Then restart the inetd Server:

[Root @ aid/etc] # kill-HUP 358

Finally, because inetd. conf should not allow normal users to read and write data, set its access permission to 600:

Chmod 600/etc/inetd. conf

The file should not be modified by any user, including the root user. Therefore, to prevent users from mistakenly modifying the file, add unmodifiable bits for the file:

Chattr + I/etc/inetd. conf

For an independent server, you must run the/usr/sbin/ntsysv command to modify it:

You only need to use the space key to select whether to start the service when the system starts. In this case, you can disable a server. If you want the system to disable the dhcpd service, select the server through the up/down key, then, remove the asterisks in [] before the service by using the space key, indicating that the service is not enabled when the system starts. To understand the specific meaning of a service, you can select the service and press the F1 key to view the meaning of the service.

After the setting is complete, the asterisk (*) is displayed only in [] before the service to be opened. Click "OK" on the Tab and press the Space key. Restart the machine.

After the machine is restarted, you can run the following command to check which services are enabled by the system to determine whether the services are disabled. For example, if you only want to provide the telnet service, run the following command:

[Ideal @ aid ideal] $ netstat-ln

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Tcp 0 0 0.0.0.0: 23 0.0.0.0: * LISTEN
Raw 0 0 0.0.0.0: 1 0.0.0.0: * 7
Raw 0 0 0.0.0.0: 6 0.0.0.0: * 7
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path

From the above command output, we can see that the system only opens port 23, that is, the telnet service.

[1] [2] [3] [4] [5] [6] [7] Next page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.