Debian Samba LDAP Integration
- install samba
- install smbldap-tools
- aptitude install smbldap-tools
- read smbldap-tools documentation
- gunzip /usr/share/doc/smbldap-tools/README.Debian.gz
- less /usr/share/doc/smbldap-tools/README.Debian
I. LDAP Server Configuration
- Copy the 'samba.schema' to be used in your LDAP server (you can find it in '/usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz' after installing the samba-doc package):
- zcat /usr/share/doc/samba-doc/examples/LDAP/samba.schema.gz > /etc/ldap/schema/samba.schema
- Modify the file '/etc/ldap/slapd.conf' to include the samba schema:
- include /etc/ldap/schema/samba.schema
- Optionally add indexes to optimize SAMBA access:
- index uid,uidNumber,gidNumber,memberUid eq
- index cn,mail,surname,givenname eq,subinitial
- index sambaSID eq
- index sambaPrimaryGroupSID eq
- index sambaDomainName eq
- Allow users to change their NT and LM Passwords changing the line: access to attribute=userPassword by: access to attrs=userPassword,sambaNTPassword,sambaLMPassword
- Restart the LDAP server.
- /etc/init.d/slapd restart
II. Samba Server Configuration
- Edit the '/etc/samba/smb.conf' to change the passdb backend from the original to:
- passdb backend = ldapsam:ldap://localhost
- Add configuration directives for the passdb system:
- obey pam restrictions = no
- ldap admin dn = cn=admin,dc=neuroimaging,dc=org,dc=au
- ldap delete dn = no
- ldap suffix = dc=neuroimaging,dc=org,dc=au
- ldap machine suffix = ou=Computers
- ldap user suffix = ou=Users
- ldap idmap suffix = ou=Users
- ldap group suffix = ou=Groups
- More to use the smbldap-tools to change passwords:
- ; Do ldap passwd sync
- ldap passwd sync = Yes
- passwd program = /usr/sbin/smbldap-passwd %u
- passwd chat = *New*password* %n\n *Retype*new*password* %n\n *all*authentication*tokens*updated*
- And if you want to administer user and groups from windows add:
- add user script = /usr/sbin/smbldap-useradd -m "%u"
- ldap delete dn = Yes
- delete user script = /usr/sbin/smbldap-userdel "%u"
- add machine script = /usr/sbin/smbldap-useradd -w "%u"
- add group script = /usr/sbin/smbldap-groupadd -p "%g"
- delete group script = /usr/sbin/smbldap-groupdel "%g"
- add user to group script = /usr/sbin/smbldap-groupmod -m "%u" "%g"
- delete user from group script = /usr/sbin/smbldap-groupmod -x "%u" "%g"
- set primary group script = /usr/sbin/smbldap-usermod -g "%g" "%u"
- Restart samba and add the smbldap admin password to let SAMBA use it:
- /etc/init.d/samba restart
- smbpasswd -w LDAP_ADMIN_PASSWORD
smbldap-tools Configuration
- Start copying the files 'smbldap.conf' and 'smbldap_bind.conf' from '/usr/share/doc/smbldap-tools/examples/' to '/etc/smbldap-tools/':
- zcat /usr/share/doc/smbldap-tools/examples/smbldap.conf.gz > /etc/smbldap-tools/smbldap.conf
- cp /usr/share/doc/smbldap-tools/examples/smbldap_bind.conf /etc/smbldap-tools/smbldap_bind.conf
- Edit the 'smbldap.conf' file; the main parameters to watch out are the 'SID', the ldap servers addresses, the TLS settings and the LDAP suffix.
- NOTE: To obtain the SID execute the following command with your SAMBA server Running:
- Edit the 'smbldap_bind.conf' file and put there the SMBLDAP administrator's DN and Password.
- Fix file permisions:
- chmod 0644 /etc/smbldap-tools/smbldap.conf
- chmod 0600 /etc/smbldap-tools/smbldap_bind.conf
- To initialize the LDAP database invoque the command:
- smbldap-populate
- NOTE: This makes the tool start adding uids and gids from 1000 (hardcoded default), if you want to start from different numbers you can use "-g <firstgid>" or "-u <firstuid>" as options to smbldap-populate.
No comments:
Post a Comment