0

How can i set the umask in ubuntu for permissions like this:

users = rwx group = r others =

I tried this mask, but it didn't work:

umask 011

1 Answers1

0

To quote the manpage (man umask):

For example, the following default ACL
       is equivalent to a umask of 022:
       u::rwx,g::r-x,o::r-x

So for your goals, you need to do the math of 777 - (OCTAL value of expected permissions) to get the umask (this is octal math of course, so not the easiest)

The permissions you want on your specific folder(s) or files is 740 (u::rwx,g::r--,o::---). 777 - 740 results in an octal value of 037. You need to use a umask, then, of 037.

Note that you may want to tread lightly here using this as the 'default' umask - some things might not be able to reach into folders and files and such.

Thomas Ward
  • 74,764
  • @2019 because folders have slightly different 'permission structure' than files. the +x bit for instance permits entering into the directory and traversing it. But for files, the +x bit indicates whether the file is executable or not. – Thomas Ward Jan 19 '18 at 00:36