9

I used one web based control panel to create some virtual users for Dovecot. That control panel no longer works so I need to do this manually.

I need to reset the password for one (virtual) user which is listed in dovecot.passwd file. The file uses CRYPT schema. How do I reset that password?

So the question boils down to - what can use to convert plain text password to CRYPT encrypted format?

6

You can use the Apache utility htpasswd. It uses crypt() to encrypt passwords by default on Linux platforms. The following will prompt you for the new password for the user jscott and will update the file /etc/dovecot/dovecot.passwd.

htpasswd /etc/dovecot/dovecot.passwd jscott

  • 1
    Word of caution. If you are using the same file as userdb too then it will have other fields which the above method will remove. So instead I guess the safer way is to use htpasswd -n jscott. This will print the encrypted password to console. Copy that manually into the passwd file. – AppleGrew Feb 6 '12 at 3:21
  • If you have CentOS, you might not have htpasswd yum install httpd-tools via serverfault.com/a/568771/82801 Also, use the -c switch to create the file if you don't have dovecot.passwd yet. – PJ Brunet Feb 10 '17 at 18:38
13

You can use the doveadm utility that comes with Dovecot:

$ doveadm pw -s CRYPT
Enter new password: 
Retype new password: 
{CRYPT}1cElWVzS3.EVg
  • Does this make the dovecot password independent of the linux user password? – User Oct 31 '15 at 19:40
  • @User: Not by itself. This is for virtual users; system users use the system password. See wiki2.dovecot.org/VirtualUsers – Richard Hansen Oct 31 '15 at 19:53
  • Can a virtual user and a system user have the same username? – User Oct 31 '15 at 20:23
4

or to avoid the prompts do:

doveadm pw -s CRYPT -p yourpassword -u user

  • 3
    This is generally a bad practice however, as the line (including the plain text password) will show in your shell history, running commands, etc. – Andrew White Sep 22 '16 at 23:31

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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