LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 09-16-2014, 11:40 PM   #1
andreiv
LQ Newbie
 
Registered: Sep 2014
Posts: 7

Rep: Reputation: Disabled
Centos 7 - Home folders are not created automatically for domain users


First, here is my setup:
Installed CentOS 7 on a physical computer, went with default settings, minimal install.
Added packages needed to join an Active Directory domain (realmd sssd adcli samba-common ntp oddjob-mkhomedir)
Joined AD (running on Windows 2008 R2), successfully using realm command
Tested login with domain user through ssh and console and it works, the user's home folder is created at first login in /home/domain/username
Installed samba
Created a very simple config for samba:
[global]
workgroup = mydomain
server string = Samba Server Version %v
security = ads
; encrypt passwords = yes
passdb backend = tdbsam
realm = mydomain.ld

# Not interested in printers
load printers = no
cups options = raw
printcap name = /dev/null

# logs split per machine
log file = /var/log/samba/log.%m
# max 50KB per log file, then rotate
max log size = 50

[homes]
comment = Home Directories
browseable = no
writable = yes

When I log in with domain account from a windows computer, it works, I see only one folder named as the username, which is expected, but when I double-click on it, it stays a while and then it says that the path cannot be found.
I look on the server and yes, the path is not there. The home folder wasn't created.

After testing and digging for a few days I believe that the problem is PAM. sssd sends the authentication request to PAM. In the
/etc/pam.d/system-auth file there is a command that says:

session optional pam_mkhomedir.so umask=0077

I changed the "optional" to "required" but no change. oddjob service is running, but the pam_mkhomedir.so seems either not to execute at all or to execute but with some error.

I found no way to debug PAM to see exactly what is going on.

I turned on debugging for sssd, I see that it indeed calls PAM for authentication, PAM replies with OK (which is true since I can logon) but it is clear that PAM fails to create the home dir.

That's it. Any idea or suggestion would be greatly appreciated.

Last edited by andreiv; 09-16-2014 at 11:46 PM. Reason: typing error
 
Old 11-19-2014, 10:07 AM   #2
Iodok
LQ Newbie
 
Registered: May 2014
Location: Germany
Distribution: Mostly centOS
Posts: 2

Rep: Reputation: Disabled
Hi andreiv

I had the same problem right now.
Could login with domain-credentials but where thrown out directly afterwards.
In /var/log/messages I could see the system tried to create the HOMEDIR /home/DOMAINNAME/USERNAME but was not allowed.
I created the folder /home/DOMAINNAME, tried again but still got the error theat HOMEDIR could not be created.
I created /home/DOMAINNAME/USERNAME , tried login in again and it worked.

That is not what I want for the future, but at least I could login and work with the machine.

Iodok
 
Old 03-19-2015, 09:09 PM   #3
sjharris68
LQ Newbie
 
Registered: Mar 2015
Posts: 1

Rep: Reputation: Disabled
Hi folks, this is actually quite straightforward, well I spent most of the morning!
Its our old friend selinux again;

http://wiki.centos.org/HowTos/SetUpSamba

If you want to share the default home directory, type this command:

setsebool -P samba_enable_home_dirs on

This worked perfectly for me.
Though, somewhat disappointingly, you still need to manually create the home dir or ssh as the user first. Samba for some reason will not use the oddjob mkhomedir utility.

Hope this helps.
Best Regards
Stephen

Last edited by sjharris68; 03-19-2015 at 09:11 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Documents, Pictures, Downloads, etc. folders aren't automatically created in Squeeze. Octoberator Debian 2 09-22-2012 11:38 AM
[SOLVED] Domain users home directories not being created by pam_mkhomedir.so manyrootsofallevil Red Hat 3 03-11-2011 05:49 AM
Why are no application folders being created in home folder? usernameinuse Linux - Newbie 3 06-15-2010 02:25 AM
General question on users accounts that are created automatically. Marty McNamara Linux - Kernel 2 01-10-2009 05:03 PM
Set home folders to 700 automatically on creation RedBox SUSE / openSUSE 6 04-09-2007 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 11:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration