How to change the password of a user in OPEN LDAP using ldif file

To change password of a user in OPEN LDAP, you need to create an ldif file in the below format:

dn: cn=username1,ou=users,dc=main,dc=rootdomain
changetype: modify
replace: userPassword
userPassword: <newpassword>

dn: cn=username2,ou=users,dc=main,dc=rootdomain
changetype: modify
replace: userPassword
userPassword: <newpassword>

dn: cn=username3,ou=users,dc=main,dc=rootdomain
changetype: modify
replace: userPassword
userPassword: <newpassword>

Once the file is ready, run the below command where <hostname> is the hostname (or IP address) of the server where OPEN LDAP is running, <admin user DN> is the DN of the admin user and <filename.ldif> is the name of the file with above formatted contents.

ldapmodify -h <hostname> -D <admin user DN> -w <admin user password> -f <filename.ldif>