Where does umask get set at system startup? Mine seems to have changed to 0002 recently
Tom H
tomh0665 at gmail.com
Fri Apr 23 08:52:34 UTC 2021
On Thu, Apr 22, 2021 at 4:01 PM Chris Green <cl at isbd.net> wrote:
> 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 sorry. I was logged in as "root" when I checked the umask. When
I'm logged in as "th", the umask is "002". So "pam_umask" does take
"USERGROUPS_ENAB" into account.
> 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.
"002" means that the group has the same perms as the user for UPG.
Given that the UPG group's only member is the user, it's mostly a
cosmetic change.
More information about the ubuntu-users
mailing list