SAMBA/LDAP Installer

At work I am in the process of building/designing a new corporate network, one of the key parts of this is a SAMBA server with an LDAP back end. I am trying to keep the whole backend stored in LDAP and make the whole setup as standards compliant as reasonably possible. The reason for using LDAP is that at somepoint we will probably have to chuck in a Windows server and fortunately this is one of the few standards it talks 🙂

Anyway, the server is running Ubuntu, the choice for this was motivated by the fact the the people doing the day to day stuff on this are not Linux users but Windows techs, therefore I am trying to make this as user friendly for them as possible.

I have been through all the howto tutorials I can find on SAMBA/LDAP and did get it working at one point but it was a painful experience until I happened to come across:

This is a wonderful script that does all the work for you 🙂 It does not just run on Ubuntu but several other distros too 🙂

IIRC the only thing I needed to do was edit /etc/samba/smb.conf and add :

ldap delete dn = Yes
add user script = /usr/local/sbin/smbldap-useradd -m "%u"
add machine script = /usr/local/sbin/smbldap-useradd -w "%u"
add group script = /usr/local/sbin/smbldap-groupadd -p "%g"
add user to group script = /usr/local/sbin/smbldap-groupmod -m "%u" "%g"
delete user from group script = /usr/local/sbin/smbldap-groupmod -x "%u" "%g"
set primary group script = /usr/local/sbin/smbldap-usermod -g "%g" "%u"

And then everything just works 🙂