Since the file base permissions for umask are 666, is it possible to make a file have 750 permissions when created?


Generally, no. Virtually every program calls open() (or creat() for that matter) with mode 0666, so whatever umask you apply, you'll never get 0750. Even the linker, which creates executables, opens output files with mode 0666 and chmod them later:

strace -f -e file gcc bla.c 2>&1 | fgrep a.out 
[pid 14096] open("a.out", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
[pid 14096] chmod("a.out", 0755)        = 0

If you want different behavior, you need to write your own tools or wrappers around existing tools that perform the intended mode change.

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.