Aug 11

This is a script to reset a list of qmail vpopmail email username. As you might know if you are using qmail vpopmail and set the qmail vpopmail user and password inside of MySQL db , qmail vpopmail set the  first 11 password  (or so) characters are random data called the “salt”. The actual password (encoded using the salt) appears after the salt . That is why you cannot just insert or update your vpopmail mysql db table and enter your new password or encrypt it with MD5. You must use vpasswd command from the qmail vpopmail and here is my script for you who want to changes of your email username.

Just create a php files and insert the script below:

#vi passwdrst.php

<?

$handle = fopen(“pwdrst.txt”, “r”);

$counter=0;

while (!feof($handle)) {

$userinfo = fscanf($handle, “%[a-zA-Z0-9._ ],%[a-zA-Z0-9. ]” );

if ($userinfo) {

list ($email, $password) = $userinfo;

$counter++;

$email=trim(strtolower($email));

$password=trim($password);

echo “username : $email@test.org password : $password  \n”;

exec(“/home/vpopmail/bin/vpasswd $email@test.org $password “);

}

$userinfo=NULL;

}

fclose($handle);

echo “Changing $counter users password”;

?>

changes the test.org to your email domain address.

Then paste your list of username and the new password you want to changes on pwdrst.txt ( use this format : username, newpassword)

# vi pwdrst.txt

test,  testi3
test2, test456
test3, test6757

Then run your  resetpwd.php script

# php resetpwd.php

username : test@test.org password : testi3
username : test2@test.org password : test456
username : test3@test.org password : test6757

Changing 3 users password

That’s it 🙂 you can changes all of the user password

Leave a Reply