Is it possible to create an umask , which will result in newly created files and directorties to have the same access rights ? e.g both of them to have for example


Directories starts with 777 - umask , and files with 666 - umask , but is it possible to create such an umask?

  • Any reason you want a non executable directory? – StrongBad Apr 21 '16 at 19:46
  • it is just an example , to demonstrate that both files and directories should have same rights – trolkura Apr 21 '16 at 19:48
  • possible duplicate: unix.stackexchange.com/questions/66910/… – StrongBad Apr 21 '16 at 19:55
  • On Linux, you can kind of get this by using filesystems that don't have any concept of permissions (such as vfat) and using the umask= option when mounting them to give them simulated permissions. Of course, this is filesystem-wide and will apply to all users who can access the filesystem, regardless of their own umasks and any use of the chmod command. – Mark Plotnick Apr 21 '16 at 21:51

No - that would be doable only if the applications requested the same permissions for both directories and files. But fopen uses 0666 for files, and direct open calls commonly use the same permissions, while directories require execute privilege to be useful, so they are usually requested with 0777 (or 0755, depending on the application).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.