Re: umask for root

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

 



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@xxxxxxxxxx>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux