Linux and Network Security 1. Introduction: first, let's take a look at the management of compressed files in linux. II. System Security: 1. logon operation before the host (1) use single-user mode: normal logon: direct root login without a password solution: you can add password verification in the boot manager ,... linux and network security I. INTRODUCTION below, first let's take a look at the management of compressed files in linux. II. System Security: 1. logon operations before the host (1) use single-user mode: normal logon: direct root login without a password solution: you can add password verification in the boot management program, it can be set during system installation. if it is not set during installation, you can also add the settings as follows: [root @ linux ~] # Grub [root @ linux ~] # Md5crypt, enter the password, generate an encrypted password, copy it, paste it to/etc/grub. conf, and enter quit to exit [root @ linux ~] # Vi/etc/grub. conf adds a new line before the title: password -- md5 encrypted password, then restarts, press any key to enter the boot screen, press the e key, no response, press the P key and enter the password before using the E key to enter the boot menu. (2) ctrl + alt + del management: in the/etc/inittab, by default, all users can use ctrl + alt + del to reboot, the main setting statement in the/etc/inittab is ca: ctrlaltdel:/sbin/shutdown-t3-r now. if you do not want to enable this function, add # in front of this line and then re-boot. if you want a specific user to use this function, you can add a-a parameter, as shown below: ca: ctrlaltdel: /sbin/shutdown-a-t3-r now with the parameter-a added, the shutdown will View/etc/shutdown when it is executed. allow file to check whether the user is in it. The/etc/shutdown. allow file needs to be added by yourself. the format is as follows: after john mary is set, it will take effect after it is restarted. (3) restrict the use of the su command: If you do not want any user to switch to the root with su, you can edit/etc/pam. add the following two lines to the d/su file: auth sufficient/lib/security/pam_rootok.so debug auth required/lib/security/pam_wheel.so group = isd so that only users in the isd group can switch to the root using su; if you want tom to switch to the root using su, run the following command: [root @ linux ~] # Usermod-G 10 admin (4) logon terminal settings: the/etc/securetty file specifies the tty device that allows root login, which is read by the/bin/login program, the format is a list of permitted names. edit the/etc/securetty file for comment, so that the root user cannot log on to the commented terminal. 2. default and hidden permissions for files and directories: (1) file permissions: you can set permissions to restrict or allow access to the following three types of users: file owner (owner), file owner of the same group of users, other users of the system. File permissions include r: Read, W: write, X: executable for the file, and permission to enter the Directory for the directory; SUID: an executable file can be used with this permission to obtain privileges. all system resources that the owner of the file can use can be accessed. this permission is only available for binary files, it cannot be used in directories or batchcompute files (shell scripts). SGID: the effect on files is the same as that on SUID. it only replaces the file owner with a user group. it can be used in binary files and directories. Sticky: the/tmp and/var/tmp directories allow all users to temporarily access files. users with this permission can only modify their own files or directories. they are only valid for directories and invalid for files. SUID, SGID, and Sticky occupy the positions of x, which are case-sensitive. if both the execution permission and SUID, SGID, and Sticky are enabled, the permission characters are lowercase s; if the execution permission is disabled, the permission characters are converted to uppercase S; the number of file permissions is R: 4; W: 2; X: 1; if you add a number before three groups of numbers, the preceding number indicates a special permission, where: SUID: 4; SGID: 2; Sticky: 1 (2) permission settings: change file permissions: when copying A file, use A to change the user group: Command: chgrp syntax: chgrp [-R] file name or directory name Example 1: change the user group of the file amf to root [root @ linux ~]. # Chgrp root amf B. change the file owner: Command: chown syntax: chown [-R] account name [: User group name] file name or directory name Example 1: change the amf owner of the file to root [root @ linux ~]. # Chown root amf C. change file permissions: Command: chmod syntax: chmod [who] [+ |-| =] [mode] file or directory name parameter meaning: Who: u, g, o, and a indicate the owner, user group, other users, and all users respectively. Operators: + add permissions;-revoke permissions; = grant permissions; Mode: r readable, w writable, x executable, t saves the program text to the Switch device, s is divided into "u + s" set SUID permission and "g + s" set SGID permission; description: multiple permission methods can be provided in a command line, which are separated by commas (,). You can also set permissions using numbers. Example 1: modify the file amf permission [root @ linux ~] # Chmod u + rw, g + wx amf D, set file default permissions: Command: umask view default permissions: umask [-S] set default permissions: umask permission number to be removed (3) hide property management A. View hidden properties: Command: lsattr [file or directory] B. set hidden properties: command: chattr [+-=] [ASacdistu] [file or directory] parameter meaning: A: Do not modify the access time atime; S: write data directly to the disk, which can effectively avoid data loss; a: Only data can be added, data cannot be deleted, and only root can be set. c: it is useful for large files and can be automatically compressed and decompressed. d: when dump backup is executed, the file can be dump; I: Do not modify the file; help system security; s: completely delete from the hard disk space; u: opposite to s, the data content still exists in the disk, can be used to restore and delete; 2. Network Security 1. Block ping: in/etc/rc. d/rc. add a line in local: echo 1> /Proc/sys/net/ipv4/icmp_echo_ignore_all save the file and restart the computer. 2. prevent IP spoofing: in/etc/host. add several lines in conf: Order bind, hosts Multi off Nospoof on 3, XINETD: service location:/etc/xinetd. d/. enable the service: modify the corresponding file in the directory, change "disable = yes" to "disable = no", and restart XINETD: [root @ linux ~]. #/Sbin/service xinetd restart 4. iptables: Firewall (1) installation: yum install iptables (2) start: service iptables start (3) close: service iptables stop 5, SELinux usage: (1) temporarily disabled: setenforce 0 (2) restart: setenforce 1 (3) completely disabled: modify the/etc/selinux/config file, change "SELINUX = enforcing" to "SELINUX = disabled", and then restart the system. we recommend that you change "SELINUX = enforcing" to "SELINUX = permissive ". 6. install the patch: go to the official website to download the patch and run the command to install it: rpm-FVL [file name]. 4. Summary
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.