Samba 2.2.2 and LDAP

Adam Williams awilliam at whitemice.org
Mon Nov 19 07:08:02 GMT 2001


>Where could I find a reasonable documentation about setting up LDAP with
>Samba 2.2.2. I have read several documents about LDAP and Samba-TNG, but as
>I have understood, LDAP is functional with Samba 2.2.2 also?

I give some examples in my LDAP presentation

ftp://kalamazoolinux.org/pub/pdf/ldapv3.pdf

It is really very simple.  The hardest part is adding machine accounts,
but I accomplish that with a PHP scripts.

   ldap root passwd = secret
   ldap root = cn=Manager,o=Morrison Industries,c=US
   ldap suffix = o=Morrison Industries, c=US
   ldap port = 389
   ldap server = littleboy
add user script = /usr/local/bin/php -f /etc/samba/add_machine_account.php
%u


$LDAPSERVER="littleboy";
$LDAPBASE="o=Morrison Industries,c=US";
$MACHINE=trim($argv[1]);
$ds=ldap_connect($LDAPSERVER);
$r=ldap_bind($ds,
             "cn=Manager, o=Morrison Industries, c=US",
             "{*password*}");
$dn = "uid=$MACHINE,ou=System Accounts,o=Morrison Industries,c=US";
$new_object["objectclass"][0] = "top";
$new_object["objectclass"][1] = "account";
$new_object["objectclass"][2] = "posixAccount";
$new_object["uidnumber"][0] = ldap_next_uid($ds, $r);
$new_object["uid"][0] = $MACHINE;
$new_object["cn"][0] = $MACHINE;
$new_object["gidnumber"][0] = 99;
$new_object["homeDirectory"][0] = "/dev/null";
$new_object["loginShell"][0] = "/bin/false";
$new_object["gecos"][0] = "Machine Account";
$new_object["description"][0] = "Machine Account";
ldap_add($ds, $dn, $new_object);
ldap_close($ds);

You have to create an ldap_next_uid for coming up with a unique uidnumber

-- 
-----------------------------------------------------------
Ximian GNOME, Evolution, LTSP, and RedHat Linux + LVM & XFS
-----------------------------------------------------------





More information about the samba-ntdom mailing list