[Samba] Samba/LDAP and home dir creation

Andrew Masterson Andrew.Masterson at nuvistaenergy.com
Tue Jun 15 15:55:54 MDT 2010


Subject: [Samba] Samba/LDAP and home dir creation

Hi, all.

I'm working on a project to create a Samba PDC 
with LDAP authentication.  I've been pretty 
successful in getting everything to work.  
However, I've run into a small snag:

The PDC is built on an OpenSuse 11.2 box.  Most of 
the member servers are also OpenSuse 11.2 boxes.  
However, a CentOS 5.5 server was just added to 
the mix.  While users can lo into the CentOS box, 
with LDAP providing the creds, no home directory 
is automagically created as in the OpenSuse 
boxes.  I'd like to fix that, with your help.

I've used authconfig-tui on the CentOS box to 
enable "Use LDAP" and "Use LDAP Authentication" 
(the equivalent of YAST's LDAP Client config 
tool?).  I believe my smb.conf and ldap.conf 
files are correct (I'll provide them if you all 
need to see them).  Any ideas?

Thanks.

Dimitri


--------------------------------------

To avoid messing with PAM, you can also do something like

root preexec=/data/Backup/createhomes.sh %D %S

in your smb.conf and the file "createhomes.sh" looks something like

#!/bin/bash

if [ ! -d /data/homes/$1/$2 ]; then
        mkdir /data/homes/$1/$2
        chmod g+s /data/homes/$1/$2
        chown $2:"domain admins" /data/homes/$1/$2
        chmod 770 /data/homes/$1/$2
        /usr/bin/setfacl -m g:"domain admins":rwx /data/homes/$1/$2
        /usr/bin/setfacl -m u:"$2":rwx /data/homes/$1/$2
        /usr/bin/setfacl -m g:"domain users":000 /data/homes/$1/$2
fi
exit 0


-=Andrew


More information about the samba mailing list