Reputation: 866
I know that permission are set using Chmod
but I am having a hard time understating how to convert an octal number into a permission.
for example
640
does this mean that the user hasrw-r----x
permission? Becuase 4+2=6 and 4 = w and 0 = - ?I understand that
777
is wide open because the user has full control fo the file 4+2+1 = 7 rwx permission the group has rwx and the second group has rwx permission If I were to answer this question my answer would be.rw-r----x
What am I doing wrong?
Upvotes: 0
Views: 3194
Reputation: 139
Maybe a picture would be easier:
..I would post it here but I don't have the rep
Some Examples:
chmod 740 test_dir
chmod 777 test_dir
Upvotes: 0
Reputation: 85897
There are 3 digits. The first digit is the user permissions, the second digit is the group permissions, the third digit is everyone else's permissions.
Every digit is formed by adding a subset of of 4 (read), 2 (write), 1 (execute).
Thus 6 4 0 means the user (6
) is allowed to read and write (4 + 2
), the group (4
) is allowed to read (4
), and everyone else (0
) has no permissions.
Upvotes: 2
Reputation: 799510
x
is 1, therefore the third triad is read as "1". 0 would have the third triad be ---
.
Upvotes: 0