Linux File Permissions 644, 755, 777 Explained

From left to right, the first digit represents the file owner’s permissions, the second digit represents the group’s permissions, and the third digit represents permissions for all other users.

Specific permissions are represented by numbers: read permission equals 4, denoted by r; write permission equals 2, denoted by w; execute permission equals 1, denoted by x.

By combining 4, 2, and 1, you get the following permission sets: 0 (no permission); 4 (read-only); 5 (4+1 | read+execute); 6 (4+2 | read+write); 7 (4+2+1 | read+write+execute).

Take 755 as an example:

The first digit, 7, equals 4+2+1, rwx, meaning the owner has read, write, and execute permissions;

The second digit, 5, equals 4+1+0, r-x, meaning group users have read and execute permissions but no write permission;

The third digit, also 5, is likewise r-x, meaning all other users have read and execute permissions but no write permission.

Here are commonly used Linux file permissions:

444 r–r–r–
600 rw——-
644 rw-r–r–
666 rw-rw-rw-
700 rwx——
744 rwxr–r–
755 rwxr-xr-x
777 rwxrwxrwx

 

chmod can also use numeric representations, such as chmod 777 file
The syntax is: chmod abc file
Where a, b, and c are each a digit representing the permissions for User, Group, and Other respectively.
r=4, w=2, x=1
For rwx attributes, it’s 4+2+1=7;
For rw- attributes, it’s 4+2=6;
For r-x attributes, it’s 4+1=5.
Example:
chmod a=rwx file 
and
chmod 777 file 
have the same effect.

Leave a Comment

Your email address will not be published.