1

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

3

1 Answer 1

2

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.