Linux security Q & A (1)

Source: Internet
Author: User

1. How to restrict excessive use of system resources?
1) edit the/etc/security/limits. conf file and add or change the following content:
* Hard core 0 // do not create a core File
* Hard rss 5000 // indicates that all users except the root user can use up to 5 MB of memory.
* Hard nproc 20 // indicates that the number of processes running simultaneously on the system is 20.
By modifying the above content in the limits. conf file, you can restrict users logging on to the system and over-using processes, core files, and memory. The asterisk (*) indicates all users logged on to the system.
2) edit the "/etc/pam. d/login" file and add the following content to the end of the file to make the above settings take effect:
Session required/lib/security/
2. How do I disable the original IP route on the server?
Run the/etc/rc. d/rc. local file in the VI editor and add the following commands to the file to disable the original path routing on the server:
For r in/proc/sys/net/ipv4/conf/*/accept_source_route; do
Echo 0> $ r
3. How do I limit the password length?
Use the vi compiler to open/etc/login. in the defs file, find the "PASS_MIN_LEN 5" line and change the content to "PASS_MIN_LEN 8" to set the minimum password length to five characters, the minimum value is 8 bits.
4. How to reduce the number of historical command lists?
The recently used command list is saved in "~ /. To reduce the number of saved command lists in the bash_history file, you can edit the "/etc/profile" file in the vi editor and modify the values of the following two items to the allowed values:
HISTFILESIZE = <integer>
HISTSIZE = <integer>
5. How do I set the NFS file system access permissions?
You can set the permission to allow the exported directory in the "/etc/exports" file. For example, if you want to set the strictest access permission, that is, you are not allowed to use any wildcard characters or write permissions of the root user, and you can only mount the directory as a read-only file system, open the "/etc/exports" file in the vi editor and add the following content:
/The Directory to be exported, such as/home/ly, allows host domain names mounted to this directory, such as liuyuan @ nf) (ro, root_squash)
Ro indicates the mount file system as the read-only file system, and root_squash indicates that the root user is prohibited from writing to the directory. Save the "/etc/exports" file and run the following command to make the modification take effect:
6. How can I disable telnet, FTP, and other services in the Liunx system?
Edit the/etc/inetd. conf file to disable services including telnet, FTP, imap, talk, and finger.
Run the chmod 600/etc/inetd. conf command to modify the permission of the file.
Run killall-HUP inet to make the modification take effect.
Another method is to use TCP to limit access to the above services on the local machine:
Modify/etc/hosts. deny to "ALL: ALL" to deny ALL access to the local machine.
Then add the allowed services and IP lines of the corresponding host in/etc/hosts. allow. For example, telnet: liuyuan.
You can use tcpdchk to check whether the settings of the two files are correct.
7. How can I restrict the character terminals that the root account can log on?
Open the/etc/securetty file in the vi editor, and comment out the login character terminals, you can add "#" before the character terminal to the annotation method, which means this is just a description.
8. In Linux, how does one prevent IP spoofing?
Use the vi editor to edit the host. conf file and add the following lines to prevent IP Spoofing:
Order bing, hosts
Multi off
Nospoof on
9. How do I prohibit normal users from using shutdown, reboot, halt, and other programs on character terminals?
Use the root permission to delete the console applications that are not required by a common account using the following commands on the Character terminal:
Rm-f/etc/security/<console application name>

This article is from the "xuanyuan meixiang" blog and will not be reproduced!

Related Article

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: 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.