In Unix I frequently change the file permissions by using the chmod command. I use 755 and 777 most of the time but don't have clear idea about these numbers. Tried googling but didn't find proper explanation for this. A detailed explanation would be helpful. Thanks.
Here is the easiest way that I know of, to explain the number based permissions in *nix.
The permissions look like this:
rwx rwx rwx
This is noticably broken down into 3 groups. The first group, on the left, is Owner, the middle group is...well.....Group, and the group on the right is User.
If you think of them as numbers, then it would look like this:
421 421 421
Where "4" stands for read, "2" stands for write and "1" stands for execute.
Lets say you want permissions of "rw- rw- rw-", you would convert that to numbers as such: "42- 42- 42-", then, add each group up to obtain the number: 666.
So, to set permissions of rw- rw- rw-, you would need to do a "chmod 666 file".
I hope this helps as I know this has helped others that I have explained it to.
Regards,
Jeff