Prefetch Technologies // Keeping your cache lines cozy

Generating passwords for LDAP

When I generate LDIF entries for new LDAP users, I need to populate the userPassword field with a crypt password or an SHA1 or MD5 hash. Sun's directory server comes with the getpwenc utility to assist with this:

$ getpwenc CRYPT password
{crypt}g72FJndhHyuiob

In addition to generating crypt passwords, it can also create MD5 and SHA1 hashes.