I have set up an ubuntu lucid LDAP+SAMBA PDC, mainly based on this article: http://ubuntuforums.org/showthread.php?t=1499753 - it works. Users can change their password by logging on to a Win Pc, and hitting Ctrl+Alt+Del. This way the unix passwords are changed as well - samba takes care of that.
I use that LDAP server for authentication from ubuntu desktops as well. They can logon, and change their password using /usr/bin/passwd
, but this way the samba password does not change.
Questions:
1) Is there a way to change not only the userPassword, but the sambaNTpassword
attribute as well? I've read of pam_smbpass.so
but I have no clue how to use that - I've even read somewhere that this way only the local smb passwords can be updated.
2) If the answer would be "no" for the 1st question, then is there a way to have slapd
sync sambaNTPassword
based on unixPassword
? Maybe setting up the "exop
" to do that?
3) If once again the answer is "no", then I could live with clear thext passwords in the userPassword and run an external script to calculate the hash for sambaNTpassword
. I tried jacksum -a md4 -q "txt:password"
but the calculated hash is not equal to the ones stored in the ldap. I have no idea why.
4) What else could I do?
You can achieve this by using OpenLDAP's
smbk5pwd
overlay.This overlay needs to be added to your
slapd
configuration. Then, any password changes via the exop "Change password" operation will also update Samba (and optionally Kerberos) passwords.You can simply configure your Ubuntu desktops to use the exop password change operation through
/etc/ldap.conf
.The way to enable this has changed over the last ten years, so I've written up a post that explains how to enable smbk5pwd in simple terms here.
Short version:
Install ldap contrib modules, eg for debian-based systems:
sudo apt install slapd-contrib
Create
smbk5pwd-module.ldif
and apply:
sudo ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f smbk5pwd-module.ldif
Create
smbk5pwd-overlay.ldif
and apply
sudo ldapmodify -Q -Y EXTERNAL -H ldapi:/// -f smbk5pwd-overlay.ldif
olcSmbK5PwdMustChange
is the password expiry time in seconds, like5184000
for two months, or31968000
for annual changes with a five day grace period.0
means no expiry.