Bug 658532 - restorecond doesn't work for user home directories on a server
Summary: restorecond doesn't work for user home directories on a server
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: policycoreutils
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: Milos Malik
Depends On:
TreeView+ depends on / blocked
Reported: 2010-11-30 16:33 UTC by Chris Adams
Modified: 2020-10-05 09:07 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2011-12-06 15:29:13 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2011:1637 0 normal SHIPPED_LIVE policycoreutils bug fix and enhancement update 2011-12-06 00:50:40 UTC

Description Chris Adams 2010-11-30 16:33:17 UTC
With RHEL 6, restorecond requires a "-u" option to manage files in user home directories.  The init script doesn't support setting this option, and it appears that the option is only intended to work when run from a desktop login session manager, not a network login (such as ssh).

How are directories (such as public_html and .ssh) supposed to get the proper labels on a server now?

Comment 1 Daniel Walsh 2010-11-30 16:48:25 UTC
You can add 


To /etc/selinux/restorecond.conf

And run the restorecond as a service and it will watch for those files/directories as they are created.

Or the admin/user can run restorecon them selves.

I have thought about running restorecond as a user session via bashrc, but I have the problem of cleaning up the process when the user logs out.

Imagine a user logging into the same machine twice, and logging out.

Comment 3 Chris Adams 2010-11-30 18:59:23 UTC
Ahh, I didn't realize it still supported ~/foo in the main conf (I thought -u was in place of that).

However, it doesn't seem to be working for me.  Running "restorecond -d" under strace, when I create ~/public_html, I see restorecond get the inotify message.  It lstat()s it, lgetxattr()s it (which shows user_home_t), and then goes back to waiting for inotify messages.  It doesn't change the context of public_html.  I added the following to /etc/selinux/restorecond.conf:


I understand how much "fun" it can be to run things for shell users (with no actual session manager).  Maybe a PAM session module that signaled the system daemon (which would then work for SSH, FTP, telnet, getty logins, etc.) could work.

Comment 4 Daniel Walsh 2010-12-22 20:23:28 UTC
I think I have this fixed in Rawhide.   After I check it out for a couple of weeks I will back port it to RHEL6.

Comment 5 Suzanne Yeghiayan 2011-02-15 21:45:55 UTC
This issue was proposed for RHEL 6.1 FasTrack but did not get resolved in time.
It has been moved to RHEL 6.2 FasTrack.

Comment 6 Daniel Walsh 2011-03-15 16:20:25 UTC
Fixed in policycoreutils-2.0.83-33.3.el6

Comment 11 errata-xmlrpc 2011-12-06 15:29:13 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, and where to find the updated
files, follow the link below.

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


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