Bug 841446 - SELinux is preventing /usr/sbin/useradd from 'write' accesses on the directory /run.
SELinux is preventing /usr/sbin/useradd from 'write' accesses on the director...
Product: Fedora
Classification: Fedora
Component: shadow-utils (Show other bugs)
i686 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Peter Vrabec
Fedora Extras Quality Assurance
: 901947 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 2012-07-18 23:18 EDT by Desktop7.org
Modified: 2013-01-20 11:49 EST (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-08-01 16:05:58 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
File: description (2.30 KB, text/plain)
2012-07-18 23:18 EDT, Desktop7.org
no flags Details

  None (edit)
Description Desktop7.org 2012-07-18 23:18:37 EDT
libreport version: 2.0.10
executable:     /usr/bin/python2.7
hashmarkername: setroubleshoot
kernel:         3.4.4-5.fc17.i686
time:           2012年07月19日 星期四 11时18分23秒

description:    Binary file, 2359 bytes
Comment 1 Desktop7.org 2012-07-18 23:18:41 EDT
Created attachment 599050 [details]
File: description
Comment 2 Miroslav Grepl 2012-07-19 17:17:58 EDT
Do you know what you were doing?
Comment 3 Daniel Walsh 2012-07-23 11:11:33 EDT
DOes useradd attempt to create the /run/user directory?
Comment 4 udtduetl 2012-07-30 10:15:50 EDT
This problem happens on fedora 17 when creating user with home directory in /run.
e.g.: 'useradd test -d /run/test' leads to this problem.

There is a SETroubleshoot detail in english:

SELinux is preventing /usr/sbin/useradd from write access on the directory /run.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that useradd should be allowed write access on the run directory by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
allow this access for now by executing:
# grep useradd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023
Target Context                system_u:object_r:var_run_t:s0
Target Objects                /run [ dir ]
Source                        useradd
Source Path                   /usr/sbin/useradd
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           shadow-utils-
Target RPM Packages           filesystem-3-2.fc17.x86_64
Policy RPM                    selinux-policy-3.10.0-137.fc17.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain 3.4.4-5.fc17.x86_64 #1
                              SMP Thu Jul 5 20:20:59 UTC 2012 x86_64 x86_64
Alert Count                   1
First Seen                    Mon 30 Jul 2012 04:10:10 PM CEST
Last Seen                     Mon 30 Jul 2012 04:10:10 PM CEST
Local ID                      a2c60538-3a33-41ce-9510-7159c5a2a045

Raw Audit Messages
type=AVC msg=audit(1343657410.310:87): avc:  denied  { write } for  pid=1607 comm="useradd" name="/" dev="tmpfs" ino=6358 scontext=unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:var_run_t:s0 tclass=dir

type=SYSCALL msg=audit(1343657410.310:87): arch=x86_64 syscall=mkdir success=no exit=EACCES a0=7fff359037e5 a1=0 a2=7f3f58bca730 a3=6165726373662f72 items=0 ppid=1558 pid=1607 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts1 ses=2 comm=useradd exe=/usr/sbin/useradd subj=unconfined_u:unconfined_r:useradd_t:s0-s0:c0.c1023 key=(null)

Hash: useradd,useradd_t,var_run_t,dir,write

audit2allowunable to open /sys/fs/selinux/policy:  Permission denied

audit2allow -Runable to open /sys/fs/selinux/policy:  Permission denied

As /run is tmpfs, this is not a good idea to put $HOME there.
Comment 5 Daniel Walsh 2012-08-01 16:04:52 EDT
Why are you putting the user account into /run?
Comment 6 Daniel Walsh 2012-08-01 16:05:58 EDT
If you want to do this you can add the rule as specified in the alert.  This does not seem to be something we want to allow out of the box.

# grep useradd /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp
Comment 7 Miroslav Grepl 2013-01-20 11:49:03 EST
*** Bug 901947 has been marked as a duplicate of this bug. ***

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