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

  1. Postfix
  2. Dovecot
  3. MariaDB/MySQL
  4. 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