RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2062601 - Incorrect umask settings for a normal user
Summary: Incorrect umask settings for a normal user
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: setup
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Martin Osvald 🛹
QA Contact: Karel Volný
URL:
Whiteboard:
Depends On: 1902166
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-03-10 09:13 UTC by Artur Glogowski
Modified: 2024-02-19 15:31 UTC (History)
6 users (show)

Fixed In Version: setup-2.13.7-8.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 08:24:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
This is the current outcome in a VM installed from the RHEL-9.1.0-20220302.1-x86_64-dvd1.iso (4.98 KB, image/png)
2022-03-10 09:13 UTC, Artur Glogowski
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-115116 0 None None None 2022-03-10 09:26:23 UTC
Red Hat Product Errata RHBA-2023:2552 0 None None None 2023-05-09 08:24:39 UTC

Description Artur Glogowski 2022-03-10 09:13:42 UTC
Created attachment 1865125 [details]
This is the current outcome in a VM installed from the RHEL-9.1.0-20220302.1-x86_64-dvd1.iso

Description of problem:
When logging in to an interactive session as a normal user umask is not set correctly.


How reproducible:
Create a VM from the official kvm qcow2 image or install a virtual machine using the ISO.

Steps to Reproduce:
1. add a normal user
2. log in as that user
3. check the umask settings

Actual results:
0022

Expected results:
0002

Additional info:
This looks like a problem with the /etc/bashrc - it can be fixed by adding this to  /etc/profile:

if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
       umask 002
    else
       umask 022
    fi

Comment 1 Karel Volný 2022-04-13 11:04:46 UTC
/etc/profile belongs to setup package, so reassigning

RHEL8 had the code:

...
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

# By default, we want umask to get set. This sets it for login shell
# Current threshold for system reserved uid/gids is 200
# You could check uidgid reservation validity in
# /usr/share/doc/setup-*/uidgid file
if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
    umask 002
else
    umask 022
fi

for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do
...

but it is missing in RHEL9, and I do not see any recent changelog entry that would correspond to such change(?)

Comment 2 Martin Osvald 🛹 2022-08-04 07:25:16 UTC
fixed in fedora:

https://pagure.io/setup/c/692ca425c4d39fb150bede011082e6bfd4472fe5?branch=master

Comment 8 Karel Volný 2022-12-08 16:51:41 UTC
now I am confused ...

the bug description says the umask should be 0002

the fix is about dropping uid check and results in 0022 - which is a change from previous release

so ... setting 0002 is now considered incorrect?

RHEL8:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 11:50:52 ] :: [   PASS   ] :: Checking for the presence of setup rpm 
:: [ 11:50:52 ] :: [   LOG    ] :: Package versions:
:: [ 11:50:52 ] :: [   LOG    ] ::   setup-2.12.2-9.el8.noarch
:: [ 11:50:52 ] :: [   PASS   ] :: Creating tmp directory (Expected 0, got 0)
:: [ 11:50:52 ] :: [   PASS   ] :: Command 'pushd /tmp/tmp.0vPt8NfVyz' (Expected 0, got 0)
:: [ 11:50:52 ] :: [   PASS   ] :: Adding the testing user (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 0s
::   Assertions: 4 good, 0 bad
::   RESULT: PASS (Setup)


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 11:50:53 ] :: [   PASS   ] :: Showing umask (Expected 0, got 0)
:: [ 11:50:53 ] :: [   PASS   ] :: root umask should be 0022 (Assert: '0022' should equal '0022')
:: [ 11:50:53 ] :: [   PASS   ] :: Showing umask for the testing user (Expected 0, got 0)
:: [ 11:50:53 ] :: [   PASS   ] :: user non-login umask should be 0022 (Assert: '0022' should equal '0022')
:: [ 11:50:53 ] :: [   PASS   ] :: Showing umask for the testing user in a login shell (Expected 0, got 0)
:: [ 11:50:53 ] :: [   PASS   ] :: user login umask should be 0002 (Assert: '0002' should equal '0002')
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 1s
::   Assertions: 6 good, 0 bad
::   RESULT: PASS (Test)


RHEL9:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Setup
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 11:47:25 ] :: [   PASS   ] :: Checking for the presence of setup rpm 
:: [ 11:47:25 ] :: [   LOG    ] :: Package versions:
:: [ 11:47:25 ] :: [   LOG    ] ::   setup-2.13.7-8.el9.noarch
:: [ 11:47:25 ] :: [   PASS   ] :: Creating tmp directory (Expected 0, got 0)
:: [ 11:47:25 ] :: [   PASS   ] :: Command 'pushd /tmp/tmp.QNWJiya44b' (Expected 0, got 0)
:: [ 11:47:25 ] :: [   PASS   ] :: Adding the testing user (Expected 0, got 0)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 0s
::   Assertions: 4 good, 0 bad
::   RESULT: PASS (Setup)


::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 11:47:26 ] :: [   PASS   ] :: Showing umask (Expected 0, got 0)
:: [ 11:47:26 ] :: [   PASS   ] :: root umask should be 0022 (Assert: '0022' should equal '0022')
:: [ 11:47:26 ] :: [   PASS   ] :: Showing umask for the testing user (Expected 0, got 0)
:: [ 11:47:26 ] :: [   PASS   ] :: user non-login umask should be 0022 (Assert: '0022' should equal '0022')
:: [ 11:47:26 ] :: [   PASS   ] :: Showing umask for the testing user in a login shell (Expected 0, got 0)
:: [ 11:47:26 ] :: [   FAIL   ] :: user login umask should be 0002 (Assert: '0022' should equal '0002')
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 0s
::   Assertions: 5 good, 1 bad
::   RESULT: FAIL (Test)

Comment 9 Martin Osvald 🛹 2022-12-20 08:44:04 UTC
(In reply to Karel Volný from comment #8)
> now I am confused ...
> 
> the bug description says the umask should be 0002
> 
> the fix is about dropping uid check and results in 0022 - which is a change
> from previous release
> 
> so ... setting 0002 is now considered incorrect?

Yes, umask for login shell is no longer set through /etc/profile, but /etc/login.defs, and its default value is 022 for everyone. If it needs to be changed, it should be done solely through that file. This change got from Fedora to RHEL9.0 due to bug 1722387 and is expected and longed for a very long time.

I should have likely closed this one as NOTABUG and created a new BZ instead of going forward and fixing it for non-login shells, but as 022 was made the default on RHEL9.0 we see complaints now about the discrepancy between login and non-login shells, e.g. here:

https://training-feedback.redhat.com/browse/RH124-744

and the included patch is just fixing this state.

I am sorry for the confusion.

Comment 10 Karel Volný 2022-12-20 14:57:47 UTC
ok, thanks for the clarification, so we can move on with this

Comment 24 Steve Bonneville 2023-02-06 19:10:57 UTC
Is there a reason why we're switching the default user umask from 002 to 022?  This breaks the idea in User Private Groups that files were automatically writable by a user and that user's private group (which was only that user) and that we could easily set up shared directories with setgid.  If we're going to go away from that in some way, Training is going to have to adjust our approach on that.  So we're interested in the logic behind this change beyond just "tightening up security".  Thanks!

Comment 27 errata-xmlrpc 2023-05-09 08:24:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (setup bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2552


Note You need to log in before you can comment on or make changes to this bug.