Hallow Everyone,
We are going to enable roundcube password plugin and configure it to let users change their password from roundcube webmail.
We are implementing this on a LinuxServer that is running
- Postfix
- Dovecot
- MariaDB/MySQL
- RoundCube running on Apache2
So before starting, Make sure you already have a fully running MailServer and you just need to implement the password plugin for users to set/change their passwords.
Change directory to where the RoundCube installation is,
/var/www/html/webmail/
First lets edit the config.inc.php file to enable the password plugin on roundcube
vim /var/www/html/webmail/config/config.inc.php
enable it by editing
// List of active plugins (in plugins/ directory)
$config['plugins'] = array(
'archive',
'zipdownload',
'managesieve',
'password'
);
Then we will go to the password plugin directory and do some changes for the plugin to function properly
/var/www/html/webmail/plugins/password/
on listing the files in the directory ls you will see the following file config.inc.php.sample which we need to rename and edit it
excecute the following command to rename the file before editing.
cp config.inc.php.dist config.inc.php
Now Edit the file to match the below settings
$config['password_driver'] = 'sql'; $config['password_dovecotpw'] = '/usr/local/sbin/doveadm pw'; // for dovecot-2.x //$config['password_dovecotpw'] = '/usr/local/sbin/dovecotpw'; // for dovecot-1.x $config['password_dovecotpw_method'] = 'CRAM-MD5'; $config['password_username_format'] = '%u'; $config['password_db_dsn'] = 'mysql://databaseuser:databasepassword@localhost/databasename'; $config['password_query'] = 'UPDATE mailbox SET password=%c WHERE username=%u'; $config['password_crypt_hash'] = 'md5'; $config['password_hash_algorithm'] = 'sha1';
Save changes and close the file.
Now we need to give roundcube user on mysql/mariadb have access to update and select privileges on the mail database
# mysql -u root -p mysql> GRANT SELECT,UPDATE ON maildatabase.mailbox to 'roundcube'@'localhost; mysql> FLUSH PRIVILEGES; mysql> quit #
Restart apache to effect the changes
/etc/init.d/apache2 restart
Thats it!!!!!!.
If you went through the process correctly, you should get the “Saved Successfully” on clicking the password change button
Thanks you
Have a try and give feedback if it helped you, by commenting it will help others that it works
Hi!
I am using Roundcube with Dovecot/Postfix setup in Ubuntu 20.4 and have activated the password plugin and started to search for what goes wrong. I am using text files for users passwords.
When trying to change password through the web mail interface I get an error saying that the password change could not be stored.
My Roundcube error log tells me:
[29-Jan-2022 11:48:59 UTC] PHP Warning: file_put_contents(/etc/dovecot/users): failed to open stream: Permission denied in /var/www/webmail.domain.tld/plugins/password/drivers/dovecot_passwdfile.php on line 72
[29-Jan-2022 11:48:59 +0000]: PHP Error: Password plugin: Failed to save file /etc/dovecot/users. in /var/www/webmail.domain.tld/plugins/password/drivers/dovecot_passwdfile.php on line 83 (POST /?_task=settings&_action=plugin.password-save)
This tells me that there is a permission-related problem with my passwords/users file for Dovecot. Correct? What should the permissions be set to to allow for www-data (?) to change the password hash? Should I set rw for both owner and group ‘root’?
I am not using both SQL (‘sql’) and Dovecot drivers as you are. Do I need to?
The permissions on my users/password file is set to:
-rw-r–r– 1 root root 4430 Jan 28 07:29 users
Hallow,
How do you update password from the text file first, i need to know the scenario of update password on text file.
Thanks