Where does umask get set at system startup? Mine seems to have changed to 0002 recently

Chris Green cl at isbd.net
Thu Apr 22 13:59:41 UTC 2021


On Thu, Apr 22, 2021 at 01:32:26PM +0200, Tom H wrote:
> On Wed, Apr 21, 2021 at 6:17 PM Chris Green <cl at isbd.net> wrote:
> >
> > I have quite a few systems running [x]ubuntu, a mix of 20.04, 20.10
> > and maybe others.
> >
> > The default umask always used to be 0022 but all my systems now
> > have it set to 0002. I can't see where it's set anywhere in /etc,
> > can anyone tell me how it gets set and why (if it has) the default
> > has been changed from 0022 to 0002?
> 
> The umask is set by "pam_umask" in "/etc/pam.d/common-session" or
> "/etc/pam.d/common-session-noninteractive".
> 
> pam_umask sets the umask by checking the following (I'm unsure of the order):
> 
> - "UMASK" in "/etc/login.defs" ("022" by default)
> 
> - "UMASK=" in "/etc/default/login" (non-existent by default)
> 
> - "umask=" in the user's shell etcfiles or dotfiles (not defined by default)
> 
> "/etc/login.defs" claims that setting "USERGROUPS_ENAB yes" changes
> the umask from "022" to 002", but it must predate the switch to
> "pam_umask" because my umask is "022" in spite of "USERGROUPS_ENAB
> yes" being set.
> 
> Check that you haven't changed one of files above.
> 
I've not changed them but it seems my umask is set by /etc/login.defs
and the additional "USERGROUPS_ENAB yes".  My userid *is* the same as
the groupid so umask gets set to 0002.

I'm not at all convinced that this is really a 'good thing' but it
does at least seem to explain why my umask is now 0002 rather than 0022.


-- 
Chris Green




More information about the ubuntu-users mailing list