Change Linux and Samba passwords
Top  Previous  Next


This script extracts all accounts with both "userPassword" and "sambaNTPassword" attributes from the OU "People" on LDAP server "my-domain.com" to the [Data] section, generates random pronounceable passwords and sets both the Linux and the Samba password for all accounts.

[Settings_Begin]
BatchSettings.Delimiter=;
BatchSettings.MarkerCol=3
BatchSettings.MarkersAutoRemove=Yes

// LDAP server, SSL must be enabled on port 636, a SSL certificate must be installed locally
SET LDServer=ldap4.my-domain.com
SET LDAdminAccount=%LDDomainPath%/cn=ldapman
SET LDAdminPW=password

SET LDDomainPath=dc=com/dc=my-domain
SET LDOUPath=%LDDomainPath%/ou=People

//Password Generator Settings
Generator.Password.DestCol=2
Generator.Password.Special.Vowels=aeiouy
Generator.Password.Special.Consonants=bcdfghjklmnpqrstvwxz
Generator.Password.Special.Numbers=0123456789
Generator.Password.Special.Special=-+#¤!_*
Generator.Password.Special.Format=rnBababas
[Settings_End]

[Init_Batch_Begin]
Lin.DS.Logon %LDServer%, %LDAdminAccount%, %LDAdminPW%   
// Get users with both userPassword and sambaNTPassword   
Data.Get.LD.Find %LDOUPath%, (&(objectClass=posixAccount)(userPassword=*)(sambaNTPassword=*)), yes, LDpath§1§   
Data.Passwords.Generate Special   
Data.Show   
[Init_Batch_End]

[Batch_Begin]
Lin.DS.Logon %LDServer%, %LDAdminAccount%, %LDAdminPW%   
Data.Loop   
 Lin.DS.Op.Init Modify, %col1%   
 Lin.DS.Op.SetProperty userPassword, %col2%   
 Lin.DS.Op.SetProperty sambaNTPassword, %col2%   
 Lin.DS.Op.Commit   
Data.EndLoop   
[Batch_End]

[Data_Begin]
[Data_End]


Tip

Print password sheets by using the print data section function.