1

I want to set umask to 343.

I calculated that the permissions of the newly created files should be: -wx-w--wx

but I get: -r---w-r--

My terminal:

meliwex@reverse-proxy:~/testfolder$ ls -l
total 0
meliwex@reverse-proxy:~/testfolder$ umask 343
meliwex@reverse-proxy:~/testfolder$ touch file1
meliwex@reverse-proxy:~/testfolder$ ls -l
total 0
-r---w-r-- 1 meliwex meliwex 0 Nov  6 09:13 file1
meliwex@reverse-proxy:~/testfolder$ umask
0343
meliwex@reverse-proxy:~/testfolder$ 

I set this umask just for testing purposes.

1
  • Welcome to Ask Ubuntu! Please don't post pictures of text, instead edit your question to include the text copy-pasted from your terminal. This makes it easier for us to help you.
    – cocomac
    Nov 6, 2021 at 3:20

1 Answer 1

2

I'm not sure how you calculated that, but a mask of 3 (011 in binary) masks the write and execute bits (the second and third bits respectively). A mask of 4 (100 in binary) masks the read bit. Therefore a mask of 0343 will result in read permissions being set for user and other, and write permission being set for group (as the execute bit is masked for files anyway). And that's what you got.

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.