This document records the rights management of Linux file system.
First, the basic rights:
1, the relationship between the user and the file:
(1) file owner, owner, master, the first set of permissions for a file represents a master owned permission
(2) file all groups, group: Genus, the second set of permissions for the file represents the permissions that belong to the group
(3) Other person, other: neither the owner nor the group, the third set of permissions for the file represents the permissions that others have
2, normal file operation permissions:
(1) R: Read, 4 to view the contents of the file
(2) W: Write (Write), 2, can edit, modify the contents of the file
(3) x: Execute (Execute), 1, file can be executed
3, Directory file operation permissions:
(1) R: Read, 4, can list the contents of the directory file, including various files
(2) W: Writes (write), 2, as follows:
A. Adding, deleting and modifying files and additions
B. Changing the location of a file
(3) x: Execute (Execute), 1, can switch to the directory file
Second, special permissions:
1. Suid,set user id,s,4: Only valid for files with execute permission, when executing an executable file with SUID permissions, the owner of the process that the executable is raising is the owner of the executable file, not the user who executes the executable file, there is a security risk
2. Sgid,set group id,s,2: similar to Suid
3, sticky,t,1: Only valid for the directory, files and subdirectories with Sticky permissions can only be deleted or renamed by their owners
Third, modify the permissions:
1, chown command: Modify the relationship between the user and the file
(1) chown-r username (owner): groupname (genus) file name
2, chmod command: Modify the permissions of the file
(1) format 1:chmod [ugoa][[+-=][rwxst] File name
u: Owner
g: Genus Group
O: Others
A: Everyone
+: Increase permissions
-: Remove Permissions
=: Set permissions
R: Read
W: Write
x: Execute
S:suid or Sgid
t:sticky, sticky bit
(2) Format 2:chmod 7777 file name
7:suid:4,sgid:2,sticky:1
7:r:4,w:2,x:1-Owner
7:r:4,w:2,x:1-genus Group
7:r:4,w:2,x:1-the others
(3) Options:
--reference:chmod--reference file1 file2: assigning file2 permissions to File1
-r: Recursively change permissions for directory files, modify permissions for files and their subdirectories under this directory file (for Chown and chmod)
This article from "Tornado" blog, declined reprint!
Rights Management of Linux System Management (i.)