here's a simple guide:
a unix permission is similar to this:
TRWXRWXRWX
the first number out of the 4 is the T part. For most files, this is 0.
Then the first RWX is the second number, the second RWX is the 3rd number and the 3rd RWX is the 4th number.
the first RWX corresponds to user permission
the second RWX = group permission
third = other users' permissions
R = read
W = write
X = execute
I think R = 4, W = 2, X = 1 (not sure about this).
so for the numbers, you add up the individual #s. For example, to set user read and write (but no execute), the number is 6.
If you want to:
- allow owner to read/write/execute
- allow group to read/execute
- allow others to read
then the permission will be:
0754
if you want owner to read/write/execute and everyone else has NO permissions, then the numbers are:
0700
Anyway, don't worry about the permissions too much when using mkdir (unless you are obsessed with security) because it will assume default permissions 🙂
-sridhar