0

https://geek-university.com/linux/set-the-default-permissions-for-newly-created-files/

So I want my umask (command) which in this case is 0002 to be subtracted (bitwise) from 666 for files and 777 default base permissions for folders. For example, the result here for a file would be 664.

This is so I can change the permissions of files I created with chmod using that new mask which is of course the default mask when you create a file with touch for example.

How can I accomplish this?

0
$ echo 'ibase=8; obase=8; (( 0666 - 0002 ))' | bc
644
$ echo 'ibase=8; obase=8; (( 0777 - 0002 ))' | bc
775
  • This is good. Only problem is that for some reason on my machine I don't have bc installed and I can't install packages on this particular machine. For some reason I only have the man page for it installed but not the actual command itself. Sounds like a bug with my distro to me. – QuantRise Jun 6 at 9:57
  • @QuantRise I tested this in Windows running WSL Debian, that didn't have bc installed either, I don't really know why. – Panki Jun 6 at 10:05
  • Hm, dom0 of QubesOS here. – QuantRise Jun 6 at 10:29

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.