Linux is so popular that many people begin to learn about Linux. I often see many commands in Linux. Do you know these commands? I will explain the Linux chmod command in this article, hoping to apply the Linux chmod command to you.
Only file owners or privileged users can use this function to change the file access mode. Mode can be in the digital format or in the who opcode permission format. Which is optional. The default value is a (all users ). Only one opcode can be selected ). You can specify multiple modes separated by commas.
Options:
-C, -- changes only outputs the information of the file to be changed
-F, -- silent, -- quiet when the chmod cannot change the file mode, the user of the file is not notified.
-- Help outputs help information.
-R, -- recursive recursively traverses sub-directories and applies modifications to all files and sub-directories in the directory.
-- Reference = filename refer to the filename permission to set the permission.
-V, -- verbose outputs the information of each file no matter whether the modification is successful or not.
-- Version: Output version information.
Who
U user
G group
O others
All users of a (default)
Opcode
+ Add permissions
-Delete Permissions
= Re-assign Permissions
Permission
R read
W write
X execution
S sets the ID of the user (or group)
T sets the sticky bit to prevent files or directories from being deleted by non-owners.
U user's current Permissions
Current permission of group g
O Current permissions of other users
In most cases, we use three Octal numbers to indicate permissions. The first one is the owner permission, the second is the group permission, and the third is the permission of other users, each permission is determined by the sum of four (read), two (write), and one (execution) values. For example, 6 (4 + 2) indicates that you have the read and write permissions, and 7 (4 + 2 + 1) indicates that you have the read, write, and execution permissions.
You can also set the fourth digit, which is located before the three-digit permission sequence. The fourth digit is 4, 2, and 1, which means the following:
4. Set the user ID during execution to authorize the process based on the file owner, instead of the user who creates the process.
2. Set the user group ID during execution to authorize the process based on the file group, instead of the user who creates the process.
1. Set the adhesion position.
Instance:
$ Chmod u + x file: add the execution permission to the file owner.
$ Chmod 751 the file owner is assigned the read, write, and execute permissions (7) to the file owner, and the read and execute permissions (5) to the file group, assign execution (1) permissions to other users
$ Chmod u = rwx, g = rx, o = x file
$ Chmod = r file: Assign read permissions to all users
$ Chmod 444 file: Same as above
$ Chmod a-wx, a + r file is the same as above.
$ Chmod-R u + r directory recursively assign read permissions to the owner of all files and subdirectories in the directory
$ Chmod 4755 sets the ID to assign read, write, and execute permissions to the owner, and assign read and execute permissions to the group and other users.
Learn about Linux chmod commands by introducing them.
- Differences between soft and hard links in Linux
- Introduction to inode and soft-hardware links from Linux
- The Linux operating system no longer supports the anteng processor.
- Details about Linux recovery
- Describes how to install a wireless NIC Driver in Linux.