Reset User's password on Database

2014-06-29
2014-06-30
  • John Tampac
    John Tampac
    2014-06-29

    Hello All,

    It's my first time to post here so please bear with me.

    We have a mail server with multiple doamins using Postfix, Dovecot, Mysql and Postfixadmin for Web Administration. Just recently we migrated some of these domains to exchange server, so we remove these domains from the postfix mail server. However user's mailbox still remain intact. We have this situation that we need to retrieve the mails for a particular user. This user already resigned the company and we dont know the password of his mailbox. It would have been easy if could reset his password but unfortunately we can not locate this account via Postfixadmin cz the domain for his account was already migrated to exchange server. Since the usernames and password are stored in database, I was thinking of resetting it manually by creating hash via command line and update the password in database using sql syntax. I know that Postfixadmin is using dovecotpw in encrypting the password and we are using md5cpryt to create hash. This was the solution I was thinking off until I started using the utility. Each time I create a hash using md5crypt scheme it gives me a different result even if the password is the same. This because of the random salt it is using. So I'm totally lost on where to go from here. Is there anyone knows what salt postfixadmin is using? or any better ideas how to reset those password?

    Thank you.
    John

     
  • Simon Hobson
    Simon Hobson
    2014-06-29

    If you recreate the domain/user in the admin control panel you can set a password then (or let the system create one). Once you do that, then the old mailbox (which as you say, is left on disk when a user is deleted) will be available again.

    Best to set the domain to inactive, that way no new mail will be added to it - which can happen if another user on the same server sends mail to that domain. Using Courier this won't stop the user accessing teh mailbox, don't know about Dovecot.

    Alternatively, rename the domain directory on disk, and create a new temporary domain in the admin pages. Eg, supposing your original user was fred@somedomain.com (and you are using a directory structure of <something>/somedomain.com/fred/...), then you could rename somedomain.com on disk to (say) temp.somedomain.com and create the new user as fred@temp.somedomain.com.

    A 3rd alternative is that you can simply copy (or move) the mailbox directories to be subdirectories of another mailbox.
    Eg, if you move <something>/somedomain.com/fred/[new|cur|tmp] to <something/someotherdomain.com/jim/.Fred/[new|cur|tmp] then you'll find Fred's Inbox has appears in Jim's account.
    I think !

     
  • John Tampac
    John Tampac
    2014-06-30

    Hi Simon,

    thank you for your reply.

    While I was waiting for a reply from my post above I decided to setup another mail server and copy the mailbox of that user to new mail server. It's like what you suggested on the 3rd method. Anyway everything is fine now.

    Thank you.

    Regards
    John