I. Description of permissions
-rw-r–r–: This is the permission bit for a file.
Let's start with this permission bit:
First bar: Specifies the file type, which indicates that the file is a normal file. (Most of the files you create are normal files or symbolic link files).
Remove the first crossbar, a total of 9 characters, to set the user's access to the file:
rw-: Top three, file owner readable, write
r –: Middle three bits, group user readable
R –: Last three bits, other users are only readable
r Read Permissions
W Write/change Permissions
X permissions to execute the script or program
Here are a few more permission commands:
R-- --- --- The document is master readable but cannot be written or executedR-- R-- --- user (typically, the default group where the file owner resides) is readableR-- R-- R- - readable by any user, but cannot be written or executedrwx R-- R- - document is master readable, write, execute, group users and other users are only readablerwx R-x --- the document is a master readable, written, and executed user- readable,rwx R-x R- x The document is master readable, written, and executed, and is readable and executed by group users and other users .RW- RW- --- The owner and the user can read and writeRW- RW- R- - text files belong to the owners and users of the group can read, write, other user- readableRW- RW- --- the owner and the user of the document and other users can read and write, use this permission with cautionsettings, because any user can write to the file * * Key content * *Here are the seven types of files:D directory. L Symbolic link (pointing to another file). s socket file. b block device files. C character device files. P name the pipe file. - ordinary files, or more accurately, do not belong to the above several types of files.
Ii. Description of the order
The general form of the chmod command absolute mode is:
chmod [mode] File
Where mode is an octal number.
In absolute mode, the Permissions section has a different meaning. Each permission bit is represented by an octal number, such as:
0 4 0 0 文件属主可读0 2 0 0 文件属主可写0 1 0 0 文件属主可执行0 0 4 0 属组用户可读0 0 2 0 属组用户可写0 0 1 0 属组用户可执行0 0 0 4 其他用户可读0 0 0 2 其他用户可写0 0 0 1 其他用户可执行
When setting permissions, simply follow the above to identify the owner of the file, the group of users and other users have the corresponding number of permissions, and add up, that is the appropriate permission to represent.
It can be seen that the maximum privilege value that a file owner, a group of users, and other users can have is 7.
Like what:
chmod 666 RW- RW- RW- give all users Read and write permissionschmod 644 RW- R-- R- - give all files the master read and write permission, all other user Read permissionschmod 744 rwx R-- R- - gives the file permission to read, write, and execute, and all other user-readable permissionschmod 664 RW- RW- R- - grants the user read and write permissions to the owner and owner of the file, and other user Read permissionschmod the rwx --- --- give the file permission to master read, write, and executechmod 444 R-- R-- R- - give all users Read access
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Linux | chmod command