I can never get the Virtualmin binary file compilation to work properly, so here’s my workaround to enable changing a user’s Virtualmin password in Roundcube Webmail.
Firstly, let’s go to the plugins/password directory (your path will be different):
cp config.inc.php.dist config.inc.php
We need to change the password driver to virtualmin (hit i for insert mode), so it reads:
$rcmail_config['password_driver'] = 'virtualmin';
(Hit Esc to exist insert mode and then ZZ to save. You’ll need these commands throughout this tutorial.)
Now we’ll use sudo instead of the binary compilation:
yum -y install sudo
Comment out the line:
At the end, add the following line (change the username to whatever user your webmail directory runs as):
username ALL=NOPASSWD: /usr/sbin/virtualmin
If you can’t work out which user it is, create and execute a PHP script in the webmail directory with the following contents:
<?php exec('whoami',$output,$return_code); print_r($output); ?>
Now we need to change the exec line in the virtualmin script:
Change the line that starts with exec to:
exec("sudo /usr/sbin/virtualmin modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue);
Finally, add password to the plugins array to activate it:
Change plugins array to:
$rcmail_config['plugins'] = array('password');
I am getting this error from roundcube’s logs. It looks like a permission issue in one of the files. Anything I should be aware of?
PHP Error: Password plugin: Unable to execute /home/domain/public_html/roundcube/plugins/password/drivers/chgvirtualminpasswd in /home/domain/public_html/roundcube/plugins/password/drivers/virtualmin.php on line 0 (POST /roundcube/?_task=settings&_action=plugin.password-save?_task=&_action=)
My method doesn’t use that binary so you shouldn’t be trying to execute the file. Make sure you change the exec() line in virtualmin.php or if you are adding a new line, comment out the old one.
When the post server uses usernames like joe.domain-com (default in Postfix) instead of email@example.com, this causes an incorrectly parsed $domain variable, which also leads to Ronnies error…
Thanks Peter – I do use the user@domain format in my config, that’s something to look out for.
I tried this for myself, I get the exec error
I was searching to fix this and after all these years some things have changed. Here is a working workaround I’ve written. http://totallynoob.com/roundcube-password-plugin-for-virtualmin/