Search code examples
alfrescoalfresco-sharealfresco-ldap

Alfresco admin password lost - self hosted alfresco community edition


Alfresco administrator password lost, it doesn't belong to the LDAP server, and even if i update the password of the admin user that i could find in the database, it doesn't not work correctly. Anyone got any idea how to solve this? Thank you

I tried changing the password in the database, in alfresco-global.properties, none works.

The alfresco version is the community edition (an old one, 4.2)


Solution

  • In Alfresco 3.x-5.0, the internal users passwords are stored as md5 hashes in the db (In Alfresco > 5.0 the hash algorithm is flexible and the table structre changed).

    e.g. to get the password has for the user admin:

    SELECT anp1.node_id,
           anp1.qname_id,       
           anp1.string_value       
    FROM alf_node_properties anp1  
       INNER JOIN alf_qname aq1 ON aq1.id = anp1.qname_id   
       INNER JOIN alf_node_properties anp2 ON anp2.node_id = anp1.node_id    
       INNER JOIN alf_qname aq2 ON aq2.id = anp2.qname_id                    
    WHERE aq1.local_name = 'password'
    AND aq2.local_name = 'username'
    AND anp2.string_value = 'admin'
    +---------+----------+----------------------------------+
    | node_id | qname_id | string_value |                     
    +---------+----------+----------------------------------+
    | 4 | 10 | 209c6174da490caeb422f3fa5a7ae634 |                
    +---------+----------+----------------------------------+
    1 row in set (0.00 sec)
    

    to update the passwort to the password admin you could set the hash 209c6174da490caeb422f3fa5a7ae634. Depending on the ids you got back from the previous query the update sql could look like:

    update alf_node_properties
    set string_value='209c6174da490caeb422f3fa5a7ae634'
    where node_id=4 and qname_id=10;
    

    You would need to restart Alfresco to take effect your change.

    There is no way to change the admin password for an existing Alfresco Repository in alfresco-global.properties. The property alfresco_user_store.adminpassword is only to define the admin password for a new repository. If you know the password of any existing user in Alfresco you could define that user temporarily as the admin:

    alfresco_user_store.adminusername=username