-rwxr-xr-x 1 root root 42304 Sep 4 18:30 test.log
- The first part is the permissions of the file :
- The first character indicates that the file is "directory, file or link file, etc."
- D: Catalogue
- -: File
- L: Link File
- B: Device interface available for storage
- C: Serial port device, such as keyboard, mouse
Rwxr-xr-x, three groups representing the permissions of the file owner (U), the same user group (g), and other non-user groups (O):
- R: Readable, 4
- W: Writable, 2
- x: Executable, 1
- rwxr-xr-x=755
- To change file permissions:
- chmod: Changing the permissions of a file
- chmod [-CFRV] MODE directory or file
- -C: report information when a change occurs
- -F: Error message not output
- -R: Working with directories and their subdirectories
- -V: Display processing information
Mode can be divided into:
- chmod 777 File:file's permission is rwxrwxrwx
- chmod a+x file: All users and Groups plus X permissions
- chmod u=rw File: Change the permissions of the owner to RW
- chmod g-x File: Remove the permissions of the user group from the Execute permission
- chgrp: Changing the user group to which the file belongs
- CHGRP [-CFRV] [group] File/directory
- The meaning of each option is the same as above
- CHGRP users file: Change the user group of file to users
- Chgrp--reference=file1 file2: Make the File2 user group the same as File1
- chown: Changing the file owner
- chown [-cfrv][owner][:[User Group]] File/directory
- Chown mail:mail File
- Chown:mail file
- Chown--reference=< files or directories > files or directories
Linux-File permissions