default umask value in RHEL 9.0 is 0022 for both root and normal user!

mprasad10021994

New Member
Joined
Dec 1, 2022
Messages
1
Reaction score
0
Credits
18
Hi Folks,

I knew that the default umask value for the root user: 0022 and for normal user 0002
But I see in RHEL 9.0 by the default umask value is same for both root and normal users: 0022!

when I check in bashrc and login.defs configuration files the default values as follows,
Would you please help me if any changes related to default umask value in RHEL 9.0 and later versions?

[[email protected] ~]$ cat /etc/bashrc | grep -i umask
# By default, we want umask to get set. This sets it for non-login shell.
umask 002
umask 022


[[email protected] ~]$ cat /etc/login.defs | grep -i umask
# Default initial "umask" value used by login(1) on non-PAM enabled systems.
# Default "umask" value for pam_umask(8) on PAM enabled systems.
# UMASK is also used by useradd(8) and newusers(8) to set the mode for new
UMASK 022
# If HOME_MODE is not set, the value of UMASK is used to create the mode.
[[email protected]~]$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.0 (Plow)
 
Last edited:


wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
8,101
Reaction score
6,980
Credits
31,134
Moving this to Redhat and Derivatives, which you might have found if you looked before you posted.

Good luck and welcome.

Chris Turner
wizardfromoz
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
5,275
Reaction score
3,903
Credits
38,482
That line your are referring to has been there since Rhel5(that's as far as I went back to check) and it's there to set the default umask for users with a non-login shell. With Rhel5, Rhel6 and Rhel7 for normal users umask still was 002, so it seems the default for users with a login shell is now 022. I tested it, if you change the defined value of UMASK in /etc/login.defs to 002 then when you login as a normal user the umask is as you would expect.
I think the key here is this part.
# Default initial "umask" value used by login(1) on non-PAM enabled systems.
# Default "umask" value for pam_umask(8) on PAM enabled systems.
I guess since that was already there in Rhel8 and didn't respond that way in Rhel8, that something must have changed in Rhel9 that it now responds here as stated here since both Rhel8 and Rhel9 use pam_umask in the pam configuration but in Rhel7 pam_umasked wasn't used in the pam configuration for login.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Latest posts

Top