2

I have a RedHat 7 server which is hooked up to LDAP and is supposed to create home folders automatically. In line with RedHat recommendation I use pam_oddjob_mkhomedir.so. Everything works fine if the user never logged in to the system.

The problem occurs if the home folder has been deleted, they are treated as scratch areas on this system. After deletion home folders are not re-created and the user is welcomed with

Could not chdir to home directory /home/users/username: No such file or directory

Can somebody shed some light on this?

UPDATE: I found that SELinux is causing this. Everything works fine if SELinux is in permissive mode. I don't want to disable SELinux, I would appreciate any help in configuring it correctly.

ANOTER UPDATE:
Found some relevant logs in /var/log/audit/audit.log

type=AVC msg=audit(1493820202.276:178): avc:  denied  { add_name } for  pid=2631 comm="mkhomedir" name="robot" scontext=system_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=AVC msg=audit(1493820202.276:178): avc:  denied  { create } for  pid=2631 comm="mkhomedir" name="robot" scontext=system_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=AVC msg=audit(1493820202.276:179): avc:  denied  { setattr } for  pid=2631 comm="mkhomedir" name="robot" dev="0:41" ino=53873787 scontext=system_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023 tcontext=system_u:object_r:nfs_t:s0 tclass=dir
type=AVC msg=audit(1493820202.277:180): avc:  denied  { write open } for  pid=2631 comm="mkhomedir" path="/nfs-server/host1/home/users/robot/.bash_logout" dev="0:41" ino=53873788 scontext=system_u:system_r:oddjob_mkhomedir_t:s0-s0:c0.c1023 tcontext=system_u:object_r:nfs_t:s0 tclass=file
Bart C
  • 201
  • 1
  • 2
  • 7
  • It looks like your NFS export is mounted using the nfs_t type, have you tried mounting it with home_dir_t? There's a vague note about this in this configuration [example](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/sect-Managing_Confined_Services-NFS-Configuration_Examples.html) – Yolo Perdiem May 08 '17 at 01:32
  • 1
    Are your home directories on an NFS share? If so, did you set "setsebool -P use_nfs_home_dirs on" – roartechs Dec 12 '18 at 15:25

0 Answers0