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

Tom H tomh0665 at gmail.com
Thu Apr 22 11:32:26 UTC 2021


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.




More information about the ubuntu-users mailing list