Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
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.
Description of problem:
Running 'sudo -s' gives the error/warning :
mkdir: cannot create directory ‘/home/user/.local’: Permission denied
(where /home/user/ is the home directory of the user running sudo
The sudo command works fine - as user becomes root (in this case)
Version-Release number of selected component (if applicable):
kde-settings-19-23.7.el7
How reproducible:
Always
Steps to Reproduce:
1. Run 'sudo -s'
Actual results:
mkdir: cannot create directory ‘/home/user/.local’: Permission denied
Expected results:
No error message
Additional info:
The problem was introduced in bug 1404382 - as /etc/profile.d/kde.csh and kde.sh now does:
# Fix the user-places.xbel error pop at first user login
if ( ! -d ${HOME}/.local/share ) then
mkdir -p ${HOME}/.local/share
endif
and:
# Fix the user-places.xbel error pop at first user login
if [ ! -d $HOME/.local/share ]; then
mkdir -p $HOME/.local/share
fi
We have 'Defaults !env_reset' in /etc/sudoers and users' home directories are NFS mounted plus the local root user doesn't have r/w access to users'
~/.local/ directories
The simple fix is to just redirect the mkdir stderr/stdout to /dev/null - and/or also check $SUDO_USER is not set/empty
You can produce the same error whenever HOME is not set. e.g.
$ env -u HOME bash -l -c 'echo "home is ${HOME}"'
mkdir: cannot create directory ‘/.local’: Permission denied
home is
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, 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/RHSA-2019:2141
This seems to be the proper syntax (forgot about using && instead of -a as well):
--- kde.csh.1 2019-08-27 14:44:47.141991394 -0400
+++ kde.csh.2 2019-08-27 14:49:37.950857442 -0400
@@ -22,7 +22,7 @@
end
# Fix the user-places.xbel error pop at first user login
-if [ ! -d ${HOME}/.local/share -a -w ${HOME} ] then
+if ( ! -d ${HOME}/.local/share && -w ${HOME} ) then
mkdir -p ${HOME}/.local/share
endif
(In reply to Steve Huston from comment #12)
> This fix seems to have broken startup scripts for csh/tcsh users due to
> using [ ] instead of ( ) :
That's a pretty fundamental error - how did that slip past QA ???