Search code examples
javaldapopenldaphp-ux

Unlock a user object in HPUX LDAP Directory Server


I am accessing the HP UX directory server through my java code, for reset & unlock a locked out user account in the Directory server.

Here is my code for user account password reset.

openConnection(details);

loadUserInformation((String)details.get("END_USER_NAME"));

ModificationItem[] mods = new ModificationItem[1];

Attribute mod0 = new BasicAttribute("userpassword", (String)details.get("NEW_PASSWORD"));

mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, mod0);

connection.modifyAttributes(user, mods);

closeConnection();

But I can't do the account unlock for the given user because I can't find the LDAP attribute for account lockout in my LDAP browser.


Solution

  • Looks like HPUX Directory server is a clone of Red hat Directory server.

    First, which unlock are you trying to perform? An account could be locked by different aspects depending on how you have setup your password policy.

    If the account is intruder detected lockout, then you need to perform the following operation:

    dn: uid=scarter,ou=people,dc=example,dc=com
    changetype: modify
    delete: passwordRetryCount
    -
    delete: accountUnlockTime
    

    -jim