3

Because files created by default having permission of 666 and umask (in permission bits form) subtract bit-wise from this permission, can we do something to give execute permission without using permission character (r,w,x) ?

I am refering to using bit-wise mask, e.g

umask 002

not setting permission character such as

umask u+x
umask u=rwx
6

This is not possible. umask only prevents permissions but never adds them. Thus you get execute permission only if the creating open() syscall does contain them. This is the case if a compiler creates an executable file.

0

The permission of a new file is computed from the permission used with the creat() call.

You umask results in:

$ umask 002
$ umask -S
u=rwx,g=rwx,o=rx

So if you use creat() with a file permission of 0777, you will get a new file with rwxrwxrx. Usual programs however use 0666as file permission argument for creat().

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.