The umask is what sets the default permissions for newly created files. Whonix has this set to 022 which gives read access to every user on the system for newly created files. 077 is recommended as it makes newly created files not readable by anyone other than the owner.
You can set the umask with the umask command. To set it as 077 by default, add umask 077 to /etc/profile and/or shell configuration files e.g. /etc/bash.bashrc.
It may be useful to add this to Whonix to prevent ordinary users from reading root owned files or a user reading another userâs files if someone has created more than one user.
The permissions for a shared folder could easily be changed with a simple chmod comand or with some file manager GUI if needed. I do agree that it doesnât add much. It could help in some cases though.
While user login and while user access additional shell.
Both Login shell and non-login shell
/home/[user-name]/.bashrc
Custom setting
Individual user
While individual user login and access additional shell
Both Login shell and non-login shell
None of these files seem appropriate to set this setting. It does not really change the distribution default setting. For example it does not cover scripts such as those run during boot or Debian package maintainer scripts.
Whereâs the default configured?
Whatâs the chance of introducing issues by changing this default?
The package maintainer scripts will need to be done from upstream.
From the manpage:
The umask utility shall set the file mode creation mask of the current shell execution environment
There doesnât seem to be anything other than shell config files or /etc/profile as it only sets it for the current shell.
This could be added to all of those files just to make sure.
There wonât be any major issues, the user may just need to change permissions of some newly created files some times. For most people, this likely wonât affect them.
Let me describe in plain English what I would like to archive. Then please let me know if that is sane. The binary way to express it like 022 / 002 is rather confusing for me.
Newly created files should by default only be readable/writeable by the one who created it.
Looks like I like neither 022 / 002. umask 077 seems nice to me.
umask 077
rm -f b && touch b && ls -la b
-rw------- 1 user user 0 Jun 29 14:26 b
umask 002 would result in:
-rw-rw-r--
Why would I want others (speak any user account) to have read access?
Why would I want group members (which group?) have read and write access?
Probably on a multi-user system where people share documents. Likely not good for Whonix though.
Since Debian uses UPGs, it will still only be the owner that has read-write access as they have their own private group. Newly created files are owned by the userâs group.
touch test
stat -c %G test
user
It is on anything other than multi-user systems.
Other users canât easily access your files without you changing some permissions. That is a good thing for security, but bad for usability.
complains about many things that probably donât apply to us
we could report a bug
we could drop a config snippet if possible
Disadvantage of umask 077 would be that:
has no security advantage
breaks the standard / Debian default
could have unforeseeable bugs
users who are accustomed to things like addgroup someusername someusergroupsameasUPG for whatever they might be doing. Perhaps two different (server) applications that need to access each otherâs home folder.
Therefore keeping the Debian default seems to take priority over output by lynis.
From reading the bug reports, to implement this, looks like the following has to be done.
There are no drop-in config folders unfortunately?
Could you test this please? If it works, submit a pull request of these files against security-misc package? First, please submit the original file as per Debian buster unmodified. In another commit, amend the file.
Bonus: config-package-dev displace; debian/copyright / COPYING, but I can apply that on top too.