Ldapsam Editposix: Difference between revisions

From SambaWiki
Line 111: Line 111:


Should the command returns:
Should the command returns:
"Unable to allocate a new gid to create Domain Admins group"
"Unable to allocate a new gid to create Domain Admins group" then make sure
Raise the gidNumber and uidNumber range (for me worked 1000000-1100000)
idmap is properly configured and the idmap range is large enough to hold the
predicted number of unique users+groups you will have in your system life time.
On a new system you should never incur into this error, in case you have to
increase the idmap range in a production system, just increase the highest value,
NEVER change the lowest value.


Give a password to the newly created Administrator user enabling it.
Give a password to the newly created Administrator user enabling it.

Revision as of 12:52, 11 September 2007

(First submitted by idra (a) samba.org)

Samba and the Editposix/Trusted Ldapsam extension

The ldapsam:editposix extension is based on the ldapsam:trusted optimization. The ldapsam:trusted optimization has been developed as a performance optimization for server that uses ldap as user and group account storage. This optimization _requires_ that all samba users and group accounts store their posix account information in the ldap tree.


The ldapsam:editposix extension has been created with the aim of making it easier to configure samba for use with an ldap server, by providing means to add the posix accounts and groups on the LDAP server without the need to use external scripts.

To further help admins we introduced the net sam provision command that helps creating the basic accounts and groups need to make smbd run.

A running winbind daemon is required to use ldapsam:editposix EVEN ON A SAMBA PDC.

Using the ldap idmap backend is strongly advised too.

Basic LDAP configuration

We will not get into the specific of LDAP configuration. To use editposix you need a very basic tree.

Here it is an example base ldif to be loaded on your server to create the basic tree structure:

dn: dc=samba,dc=org
objectClass: top
objectClass: dcObject
objectClass: organization
o: samba.org
dc: samba

dn: cn=admin,dc=samba,dc=org
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: admin
description: LDAP administrator
userPassword: secret

dn: ou=users,dc=samba,dc=org
objectClass: top
objectClass: organizationalUnit
ou: users

dn: ou=groups,dc=samba,dc=org
objectClass: top
objectClass: organizationalUnit
ou: groups

dn: ou=idmap,dc=samba,dc=org
objectClass: top
objectClass: organizationalUnit
ou: idmap

dn: ou=computers,dc=samba,dc=org
objectClass: top
objectClass: organizationalUnit
ou: computers

Download it _here_. (this is a place holder, is it possible to upload files on mediawiki ?)

Configuring smb.conf

you need to properly configure smb.conf before running any daemon or command.

Here is the bare minimum options to set in smb.conf:

  encrypt passwords = true
  passdb backend = ldapsam
  ldapsam:trusted=yes
  ldapsam:editposix=yes
  ldap admin dn = cn=admin,dc=samba,dc=org
  ldap delete dn = yes
  ldap group suffix = ou=groups
  ldap idmap suffix = ou=idmap
  ldap machine suffix = ou=computers
  ldap user suffix = ou=users
  ldap suffix = dc=samba,dc=org
  idmap backend = ldap:"ldap://localhost"
  idmap uid = 5000-50000
  idmap gid = 5000-50000

A quick setup

Do not run any daemon until told, use a fresh install or wipe out any previously created tdb before starting.

To quickly set up and test this feature follow these steps as root:

Configure and run your ldap server, you may use the above base ldif as a starting point. Make sure the defined ldap admin works correctly.

Configure smb.conf

Add the ldap admin password to the samba secrets database:

 # smbpasswd -w secret

Start winbindd only.

 # /etc/init.d/winbindd start

provision the tree:

 # net sam provision

Should the command returns: "Unable to allocate a new gid to create Domain Admins group" then make sure idmap is properly configured and the idmap range is large enough to hold the predicted number of unique users+groups you will have in your system life time. On a new system you should never incur into this error, in case you have to increase the idmap range in a production system, just increase the highest value, NEVER change the lowest value.

Give a password to the newly created Administrator user enabling it.

 # smbpasswd Administrator
 New SMB password:
 Retype new SMB password:

Now start also nmbd and smbd:

 # /etc/init.d/nmbd start
 # /etc/init.d/smbd start

Grant yourself some privileges:

 # net rpc rights grant Administrator SeAddUsersPrivilege -U Administrator
 # net rpc rights grant Administrator SeMachineAccountPrivilege -U Administrator

Managing your DB

At this point you will be able to connect from any windows client or use any samba tool to manage your users groups and machines with the Administrator user.