11

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?

4 Answers 4

7

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

2
  • 2
    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, 2012 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, 2017 at 18:38
22

You can use the doveadm utility that comes with Dovecot:

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

or to avoid the prompts do:

doveadm pw -s CRYPT -p yourpassword -u user

1
  • 9
    This is generally a bad practice however, as the line (including the plain text password) will show in your shell history, running commands, etc. Sep 22, 2016 at 23:31
1

doveadm pw -s SHA512-CRYPT

is also good.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .