On Tue, Aug 24, 2021 at 10:28:17AM +0200, François Patte wrote:
The only file talking of umask is /etc/bashrc:
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
I don't understand the meaning....
It means:
If your UID is greater than 199 *AND* your username and group name are
the same, set the umask to 002, otherwise, set the umask to 022.
This makes sense. System accounts are usually below UID 200, so you
want a more restrictive umask on them.
As for the logic about user == group, if your group isn't the same as
your username, then you are likely to be in a UNIX group that has
multiple members, so it is a good idea to set your umask to 022 so
files you create aren't writable by others in your group by default.
But if your group is the same as your username, most likely there
won't be other users with the same group ID, so there is little risk
to having group-writable files created by default.
As for why your system has a umask of 077, that sounds like you've
made some change to your configuration someplace. If you don't see it
in one of your dot files, /etc/bashrc or /etc/profile.d, the
pam_umask.so in /etc/pam.d/postlogin looks for umask from the
following locations:
* umask= entry in the user's GECOS field
* umask= argument
* UMASK entry from /etc/login.defs
* UMASK= entry from /etc/default/login
(Apparently the GECOS field in the pwent can be split on a comma and
have metadata like umask= in it. Check 'man pam_umask' for more
details)
I suggest checking those places too.
--
Jonathan Billings <billings(a)negate.org>