I. Rights Management
The permissions for a file are defined primarily for three types of objects:
Owner: Master, u
Group: Genus, G
Other: Others, O
Each file has three permissions defined for each type of visitor:
R:readable
W:writable
X:excutable
File:
R: You can use the File View class tool to get its contents;
W: can modify its contents;
X: This file can be brought to the kernel to boot into a process;
Directory:
R: You can use LS to view the list of files in this directory;
W: You can create files in this directory, or delete files in this directory;
X: You can use Ls-l to view the list of files in this directory, CD access to this directory;
Combination of permissions
---000 0
--x 001 1
-w-010 2
-WX 011 3
r--100 4
R-x 101 5
RW-110 6
RWX 111 7
For example:
640:rw-r-----
755:rwxr-xr-x
Modify file Permissions: chmod
chmod [OPTION] ... Octal-mode FILE ...
-R: Recursive Modify permissions
chmod [OPTION] ... Mode[,mode] ... FILE ...
MODE:
To modify all permissions for a class of users:
u=
g=
o=
ug=
A=
u=,g=
Modify one or some bit permissions for a class of users
u+
U-
The owner and owner of the modified file: only root is available;
Modify the owner of the file: Chown
chown [OPTION] ... [OWNER] [: [GROUP]] FILE ...
Usage:
OWNER
Owner:group
: GROUP
Note: The colon in the command is available. Replace;
-R: Recursive
Masking code when a file or directory is created: Umask
File:666-umask
Note: If there is an X permission in the result of a user with a class that has the permissions reduced, its permissions +1
Dir:777-umask
Umask: View
Umask #: Setting
Hide Permissions Lsattr/chattr
The host is exposed directly to the Internet or in other dangerous environments, has many shell accounts or provides network services such as HTTP and FTP, and should generally be installed after the installation
Tighten use the following command:
Chattr-r +i/bin/boot/etc/lib/sbin
Chattr-r +i/usr/bin/usr/include/usr/lib/usr/sbin
Chattr +a/var/log/messages/var/log/secure (...)
Lsattr is generally used to view the above file
linux-Basics-day Fourth