[Samba] Automatic creation of users home directories - problem with username case

Dmitrijs Demidovs dmitrijs.demidovs at datakom.lv
Tue Oct 23 05:32:51 MDT 2012


Hello list,

I have a problem with Samba and automatic creation of user home directories.

There is a Win2008R2 AD and Samba are successfully joined to domain. Samba is running on CentOS 6.3 32-bit.
Domain users can access Samba without problems. We decided to use home directories and mount them as network H: disk, so user can store it's data there.

The problem is that WinXP users after restart can logon to AD using any form of logon name - i.e.
"Name.Surname"
"name.surname"
"NAME.SURNAME"

And Samba is automatically creating home directory for each form of logon name variation:
/home/Name.Surname
/home/name.surname
/home/NAME.SURNAME

So user John.Doe one morning will see that all content from it's H: disk is gone just because he logon in AD using different variation of his account name.

Have anyone the same problems with home directories? 
Is there any solution?


We used this article as a guide:
wiki.samba.org/index.php/Samba_%26_Active_Directory

And I am unable to manage pam_mkhomedir.so to working - that's because "root preexec " shell script are used.



Our config:
---
[global]

   workgroup = DOMAINNAME
   realm = DOMAINNAME.LOCAL
   security = ads
   idmap uid = 10000-20000
   idmap gid = 10000-20000
   winbind separator = +
   template homedir = /home/%U
   template shell = /sbin/nologin
   winbind use default domain = true
   winbind offline logon = false
   log file = /var/log/samba/log.%m
   max log size = 50
   passdb backend = tdbsam
   preferred master = no
   encrypt passwords = yes
   winbind enum users = Yes
   winbind enum groups = Yes
   winbind nested groups = Yes


[homes]
   comment = Home Direcotries
   valid users = %S
   read only = No
   browseable = No
   path = /home/%S
   root preexec = /var/lib/samba/scripts/mksambahomedirs.sh %S
---


mksambahomedirs.sh"
---
#!/bin/bash

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



Thank you in advance for any help!


More information about the samba mailing list