3

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
pkaramol
  • 2,587
  • 4
  • 36
  • 71

1 Answers1

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.

Freddy
  • 25,172
  • 1
  • 21
  • 60