The Linux user group is divided into: owner, group, other group
- Owner: Who created, who is the owner. Command: Ls-al
- Group: When creating a file or folder, this file or folder is assigned to the user group, which effectively isolates the file.
- Other groups: In contrast to the group, it is the other group
Linux file permissions: File properties, modify file properties, and permissions
- File properties: The file attributes are 10 bits in total. In addition to the first, the remaining three-bit one-component three groups
First bit: attributes (-for files, D for directories, L for linked files, B-Interface devices, C-port devices)
First group: Permissions for the file owner.
Second group: Permissions for the same user group
Group Three: Permissions for other groups
Rights r =4 Readable, W =2 writable, x = 1 executable
CHGRP: Change the user group that the file belongs to chgrp [user group name] File
Chown: Change the file owner Chown [account name] file or directory
chmod: Change the permissions of a file r=4,w=2,x=1
Or
A=all; U=user, G=group; O=other; + Add permissions;-turn off permissions; = Set permissions
For example: Modify the permissions to-rwx rw-r
Mode one: the first group rwx = 4+2+1=7; the second group rw-= 4+2+0=6; The third group r--: 4+0+0=4;
Command: chmod 764 FileName
Mode two; chmod u=rwx,g=rw,o=r FileName
For example, if you do not need to know the file permissions, you need to increase the file execution permissions or remove the execution permissions
chmod a+x FileName; chmod a-x FileName
Permission meanings for directories and files:
- For file:
-
- R = Read: reads the actual contents of the file.
- w = write: Edits the actual contents of the file. The file cannot be deleted.
- X =execute: Executes the file. The file cannot be deleted.
- For directory:
-
- R: The LS command can be used to read files in the directory.
- W: You can change the list of directory structures.
- Create a new file or directory
- Delete files, directories
- Renaming files or directories
- Transferring files, directories
- X: Whether the user has permission to enter the current directory for Work commands: CD to switch directories.
File, r= can access the file directory linked list of this file, can allow access to this file requires X permission.
x= switch, whether access to this directory is allowed. Whether the directory can be accessed via the CD command.
linux-user groups, permissions