Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to export users with passwords? The Users export module cannot help, it export without passwords.

share|improve this question
do you got some advance? – Adrian Cid Almaguer Feb 2 at 0:54

User passwords are stored using a one-way hashing algorithm and cannot be converted to plaintext. In addition, each Drupal site uses a unique cryptographic salt, so that the same plaintext password on two Drupal sites will not result in the same hashed password.

In other words, there is no way to generate a list of usernames and plaintext passwords.

share|improve this answer
clear and succint response! – tenken Jan 29 at 20:53
With all due respect, even though this answer is correct, the salt part is a bit misleading. If you copy the password hash from site A to site B,the original password will work in both sites. However, if site A and B generated the hashes for same plaintext password separately, the hashes would be different. So basically you cannot generate a dictionary to reverse lookup password from hashes. But for import/export purposes, copy the password hash will be enough. – AyeshK Jan 30 at 2:52
@MPD i want to make my users to login on Django (python) site with the same data, So if not possible export passwords i need to set new passwords - so now users need to remember 2 passswords from 2 parts of my service wihich is bad – Vic Nicethemer Jan 30 at 10:07

In very limited use cases, you really might be in need to allow certain users seeing other user's passwords. You can use the AES module.

However, for exporting these passwords you will have to write a custom module using AES module's decryption mechanisms (as the passwords won't be stored as plain text as well).

A note of warning: I strongly suggest checking, whether you really need to have users see other user's passwords. This implies a huge security impact on your site, and - as many users still use the same passwords on different web sites - on the security of your user's other profiles around the web.

Edit: After you provided some more insights on your requirements, a way to change the passwords in another application when a Drupal user sets a new password, without having to store it unhashed.

You will need to create a custom module. Implement the following hooks (replace MYMODULE with your module name):

 * Implements hook_form_alter().
function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  // Alter all forms that allow editing the password:
  switch ($form_id) {
    case 'user_register_form':
    case 'user_profile_form':
      // Add an own submit handler to the user forms.
      $form['#submit'][] = 'MYMODULE_set_password_submit';

 * Submit handler setting the password in the third-party application.
function MYMODULE_set_password_submit($form, &$form_state) {
  // Whether the password was changed.
  if (!empty($form_state['values']['pass'])) {
    // Get the password.
    $password = $form_state['values']['pass'];

    // And now you can use the contents of $password to call
    // your other applications API for resetting passwords or
    // hashing / setting the password using direct database
    // access.

share|improve this answer
i want to make my users to login on Django (python) site with the same data, So if not possible export passwords i need to set new passwords - so now users need to remember 2 passswords from 2 parts of my service wihich is bad. – Vic Nicethemer Jan 30 at 10:08
Added a small example on how you could achieve your required feature without having to save/export unhashed passwords. You will just need to have a way to set the passwords in your Django application from within your Drupal. (An API or direct access to its database.) – Mario Steinitz Jan 30 at 11:42

As @MPD says, you can't do this, however you can export all the users and import with a random password and use this ways to set the password:


Generate new password for users periodically and notify user of new password

share|improve this answer
Nice workaround! never heard of these modules, until now :-) – No Sssweat Jan 29 at 23:48
@NoSssweat I hope that this modules can help the OP – Adrian Cid Almaguer Jan 30 at 0:01

you just export data only (not structure and data) from users table of old database and import this to the new database. All users with password can be export this way too

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.