I want to set permissions such that whenever a directory is created by a 'user' then its default permissions should be 775.
But when that 'user' creates a new file then default permissions should be 774.
How can I achieve this?
|
I want to set permissions such that whenever a directory is created by a 'user' then its default permissions should be 775. But when that 'user' creates a new file then default permissions should be 774. How can I achieve this? |
|||||||
|
|
I'm not sure how to get those exact permissions, but using umask, you can set the permissions for files and directories within 111 of each other. This site explains how it works: http://kb.iu.edu/data/acge.html For example:
would give you 775 for directories and 664 for files. Not exactly what you're looking for, but you might be able to figure something out related to umask. The default umask can be found in /etc/profile. This can be overridden for each user by editing the umask in ~/.profile. Note: The default umask for most unix machines is 022, which gives you: 644 (rw-r--r--) for files and 755 (rwxr-xr-x) for directories. |
||||
|
Umask explainedThe default file permissions on newly created files and directories are a standard permission ( The three numbers in the umask represent user, group and anyone permissions respectively. The number represents three binary digits whether to remove a specific permission or not.
To calculate which permissions a new file will have given a certain umask, start with the default permission and subtract the umask.
|
|||
|
|