Common Linux file permissions:
444 r--r--r--
RW-------
644 rw-r--r--
666 rw-rw-rw-
RWX------
744 rwxr--r--
755 Rwxr-xr-x
777 Rwxrwxrwx
From left to right, 1-3 digits represent the permissions of the file owner, 4-6 digits represent the permissions of the same group of users, and 7-9 digits represent the permissions of other users.
And the specific permissions are represented by numbers, read permissions equal to 4, the right to write is equal to 2, with W, the execution of the right is equal to 1, expressed in X;
Through the combination of 4, 2 and 1, the following permissions are obtained: 0 (no permissions); 4 (Read permission); 5 (4+1 | Read + execute); 6 (4+2 | Read + write); 7 (4+2+1 | Read + Write + execute)
Take 755 as an example:
1-3 bit 7 equals 4+2+1,rwx, the owner has read, write, execute permissions;
4-6 bit 5 equals 4+1+0,r-x, the same group of users with Read, execute permissions, but no write permission;
7-9-bit 5, IBID., is also r-x, other users have read, execute permissions but do not have write permission.
RWX Permissions Digital Interpretation
Chmod can also use numbers to indicate permissions such as chmod 777 file
Syntax is: chmod ABC file
Each of these a,b,c is a number, representing the permissions of user, Group, and other respectively.
R=4,w=2,x=1
To rwx the property is 4+2+1=7;
To rw-the property is 4+2=6;
To r-x the property is 4+1=7.
Example:
chmod a=rwx File
And
chmod 777 File
Same effect
chmod ug=rwx,o=x File
And
chmod 771 File
Same effect
If you use chmod 4755 filename, you can make this program have root permissions