[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: UPG and the default umask

On 2010-05-19, Aaron Toponce <aaron.toponce@gmail.com> wrote:
> I suggested this, which I don't think is complex. However, what you have
> suggested should work just fine.
> if [ "$(id -un)" =3D "$(id -gn)" ] && [ "$UID" -gt 99 ]; then
>     umask 0002
> else
>     umask 0022
> fi

id -n might cause network accesses, if NSS is configured to do so.  Is there
a precedent in profile for this?  (I don't see any, just id -u which calls

> The logic is simple, IMO: if the group name and the user name match,
> it's UPG. If UPG and it is not a system user, then set the umask to
> 0002. Otherwise, set to 0022.

When I do "newgrp <group>" it's still UPG and the umask should still be
2, no?  This check would change my umask.

> I don't know if that logic will match any additional cases (unless user
> accounts are created under ID 1000), however, so we should be good with
> your simpler logic on just matching the UID.


Kind regards,
Philipp Kern

Reply to: