3

This question already has an answer here:

I am setting the umask to a new value as below. However although I am applying rxw to the user, this does not seem to be respected (?)

/home/pkaramol
$ umask u=rxw,g=rw,o=r
/home/pkaramol
$ umask -S
u=rwx,g=rw,o=r
/home/pkaramol
$ rm -rf afile && touch afile;
/home/pkaramol
$ ls -l afile 
-rw-rw-r-- 1 pkaramol pkaramol 0 Μar   2 10:30 afile

edit:

$ mount | grep -E '\s/\s'
/dev/sda3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)

$ mount | grep -i home
/home/pkaramol

marked as duplicate by Jeff Schaller, Thomas, Haxiel, jimmij, Mr Shunz Mar 4 at 10:59

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    @steve check my update; – pkaramol Mar 2 at 8:42
6

touch creates files with permission 666 (-rw-rw-rw-) by default (with umask 000). umask can only subtract permissions ("take permissions away"). In your case only o=w is affected. It cannot add any flags (u=x) to newly created files. You have to use chmod for that.

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