Problem Install Roundcube plugin - Change Password

36 posts / 0 new
Last post
#1 Fri, 09/21/2012 - 04:01

Problem Install Roundcube plugin - Change Password


I am trying to install change password plugin to roundcube but it does not work. The error log show

DB Error: MDB2 Error: not found Query: _doQuery: [Error message: Could not execute statement] [Last executed query: SELECT update_passwd('........', '.........')] [Native code: 1305] [Native message: FUNCTION abc_roundcube.update_passwd does not exist] in /home/abc/public_html/webmail/program/include/rcube_mdb2.php on line 727 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)

Anyone can help me to solve.

thanks Keith

Fri, 09/21/2012 - 15:58


Note that we didn't actually write that particular plugin. However, I sat down recently, and tinkered with it a bit to get it up and running.

It actually works quite well!

I wrote up instructions on how to get it working, those are attached to this post.

Fri, 09/21/2012 - 21:33 (Reply to #2)

Thanks for reply but i cannot access the link and show access denied!

Thank Keith

Fri, 09/21/2012 - 22:48 (Reply to #3)

Durn! Okay, I attached them to the post above :-)

Let us know how those work for you!

Sat, 09/22/2012 - 12:18 (Reply to #4)

Thank you so much and write the step. I tried but still no lucky. It show below error on log.

PHP Error: Password plugin: Unable to execute /home/abc/public_html/webmail/plugins/password/helpers/chgvirtualminpasswd in /home/abc/public_html/webmail/plugins/password/drivers/virtualmin.php on line 73 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)

any ideal of this error.

thanks Keith

Thu, 08/14/2014 - 15:21 (Reply to #5)

Hi I have the same mistake. But if i print in virtualmin.php i get this.

modify-user --domain localhost --user user_domain --pass newpass

I try in console with this

./chgvirtualminpasswd modify-user --domain localhost --user user_domain --pass newpass

and get this

"Virtual server localhost does not exist

Modifies a mail, FTP or database user in a Virtualmin domain.

virtualmin modify-user --domain"

I try with another domain in console and works!! Where i have to change to take my domain and not localhost?

Thanks Regards

Wed, 11/05/2014 - 17:00 (Reply to #6)

For Those who are having problems with the plugin change password in virtualmim:

First, follow these steps:

There are several possible causes of installation problems, but to know what your specific problem, please check the error log in: public_html/roundcube/logs

if you are using name@domain login format, just try to edit public_html/roundcube/plugins/password/drivers/virtualmin.php.


default: // username@domain
$domain = substr(strrchr($username, "@"), 1);


default: // username@domain
$username = $rcmail->user->user2email($_SESSION['username']);
$username = $username[0];
$domain = substr(strrchr($username, "@"), 1);

Alternative ways:

Most errors occur during execution of the "exec" command. In my case, at line 64 of file public_html/roundcube/plugins/password/drivers/virtualmin.php.

To see the console error messages, which are crucial to figure out the problem, edit the line:

'message' => "Password plugin: Unable to execute $curdir/chgvirtualminpasswd"

(in my case, line 74)

'message' => "Password plugin: Unable to execute $curdir/chgvirtualminpasswd".print_r($output,true)

With this change, you may find all errors in the console public_html/roundcube/logs/error file. So it can be reversed later.

If you want, you can undo the changes made to this line after solving the problem.

In the specific case of who uses email in name@domain format (like my case) may likely be necessary to edit the domain and also change the format of the username.

If you receive the message: "Virtual server localhost does not exist", try manually changing the variable $domain for your or the name of your server.
in my case, I changed the line:

$domain = $rcmail->user->get_username('domain');


$domain = $_SERVER['SERVER_NAME'];

After the change, I receive the error:

No user named was found in the server

To fix, I modified the line:

$username = escapeshellcmd($username);


$username = escapeshellcmd(str_replace('-'.$domain, '@'.$domain, $username));

Note that the problem is the hyphen instead of the at sign, but do not just replace hyphen per at sign because the username can also take hyphens.

After the changes, it worked.

Wed, 02/04/2015 - 18:25 (Reply to #7)

Thanks, that was very useful, especially the bit about how to get the console error messages to output. Helped me figure out exactly which changes I needed to make.

Sun, 01/29/2017 - 15:03 (Reply to #8)
Luiz Lopes

Wow it worked! For years I could never make it work. Thanks.

I did it in Ubuntu 16.04 and Roundcube 1.2.3. Just replaced the "default: // username@domain" part in the drivers/virtualmin.php file. Thanks.

Sat, 11/22/2014 - 13:15 (Reply to #9)

Do these instructions still apply to roundcube version 1.0.3 ??


Sun, 09/23/2012 - 22:44

Are you seeing any errors in your Apache error logs, in $HOME/logs/error_log?

Mon, 09/24/2012 - 00:25 (Reply to #11)

Thanks for follow and help,below is a error log when I change the password :

[Mon Sep 24 12:51:17 2012] [warn] [client] mod_fcgid: stderr: PHP Notice: Undefined offset: 1 in /home/abc/public_html/webmail/skins/larry/svggradient.php on line 26, referer:

thanks Keith

Tue, 09/25/2012 - 09:52

Hi all,

Anyone can help to solve the problem ?

thanks Keith

Tue, 09/25/2012 - 10:12

I do not currently know what the problem is... so far, I've only been able to reproduce the problem you're seeing on CentOS.

Is that by chance what you're using?

I did notice that it seems to work on CentOS if the PHP Execution mode is set to mod_php.

We don't normally recommend that, as it's less secure, but that might get you up and running with that plugin in the meantime.


Tue, 09/25/2012 - 10:38


Well, I still working solution for password change and currently virtualmin installed on ubuntu 12.04 LTS version.

I tested the command "./chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass" on console. It worked, therefore I believe that it is some problem on PHP or something wrong.

If you have any idea, please share on post.

thanks keith

Tue, 09/25/2012 - 10:55


Just found that I used username@domain for format but the change passward code passed wrong information to command and caused unable to change passward. I am checking the code.

thanks Keith

Tue, 09/25/2012 - 23:15

I did discover one issue... while I'm not sure about the user@domain issue you saw, I did see that even when using the user.domain format, it could still run into issues where Virtualmin was getting confused, thinking it's being called from a web browser.

But it's technically not, it's command line API is being called.

You may need to set (or rather, unset) an environment variable where RoundCube is calling out to the Virtualmin command line program.

If you edit this file:


And jump to line 64, you'll see this line:

exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue);

Change that to read as follows:

exec("SCRIPT_NAME='' $curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue);

You're adding in this part:


That will assure that Virtualmin doesn't think it's being executed as a web app.

After making that change, I was able to use it on CentOS 6.3, which wasn't previously working for me.

Let us know if that does the trick for you!


Wed, 09/26/2012 - 00:21

Eric, Thanks again. I found the problem that when the command exec("$curdir/chgvirtualminpasswd modify-user --domain $domain --user $username --pass $newpass", $output, $returnvalue); triggered. It is incorrect information passed to value.

For example : The virtualmin email format is user@domain

If the email address is "", the result of value is

$domain = (correct) $username = (incorrect), problem is here. It should be "keith", therefore it caused error here. $newpass = 12345 (correct)

any idea where convert the value to $username ?

thanks Keith

Wed, 09/26/2012 - 16:05

Okay, if you jump to line 51 of "roundcube/plugins/password/drivers/virtualmin.php", you'll see this case statement:

        case 8: // domain taken from alias, username left as it was
            $email = $rcmail->user->data['alias'];
            $domain = substr(strrchr($email, "@"), 1);

Try adding in the following $username line, so that it looks like this:

        case 8: // domain taken from alias, username left as it was
            $email = $rcmail->user->data['alias'];
            $domain = substr(strrchr($email, "@"), 1);
            $username = str_replace("-$domain", "", $username);

When using the user@domain format, that should correct it so that it passes in a username that Virtualmin understands.

Let us know if that does the trick!


Wed, 07/03/2013 - 05:16 (Reply to #19)

Using andreychek's instructions at the following links.

I was able to get the password plugin working.

I was encountering the following error

PHP Error: Password plugin: Unable to execute .../plugins/password/drivers/virtualmin.php on line 73 (POST /m/?_task=settings&_action=plugin.password-save?_task=&_action=)

Using the instructions provided work but if you use the username@domain format, you need to edit line 51 as per andreychek's latter post above.

Thank you to andreychek.

Ubuntu Server 12.04.2 Webmin 1.631 Virtualmin 4.01.gpl

Mon, 04/01/2013 - 13:59

Sorry for jumping into an old thread I have followed every relevant thing:

I followed the guide at

I also implemented the suggessions in the following:


But I am still getting new password could not be saved:

[01-Apr-2013 18:21:08 +0100]: PHP Error: Password plugin: Unable to execute /home/conjurenet/domains/ in /home/mycompany/domains/ on line 75 (POST /?_task=settings&_action=plugin.password-save?_task=&_action=)

Wed, 04/03/2013 - 01:25

Same problem here tried to use versions 0.8.1, 0.8.4, 0.8.6 all of them get "password could not be saved" and that's all no errors, nothing.

Wed, 04/17/2013 - 09:04
Alain Cox

I get the following error in my Apache file:

sh: ..../public_html/roundcube/plugins/password/helpers/chgvirtualminpasswd: No such file or directory

i have read:

I have done

chown plugins/password/helpers/chgvirtualminpasswd.c (note the .c above - since there is no chgvirtualminpasswd file)

also done chmod 4550 on the chgvirtualminpasswd.c file

But passwordchange still not working.

I still get the same error in my Apache file

Wed, 04/17/2013 - 10:03

chown plugins/password/helpers/chgvirtualminpasswd.c (note the .c above - since there is no chgvirtualminpasswd file)

Yeah, that's the problem there :-)

If you don't have the file "chgvirtualminpasswd", that'll cause the error you're seeing.

That suggests you may have missed a step in the documentation you linked to :-)

I'd suggest going over those steps again, and making sure they're all complete. Pay particular attention to the step where you compile the program by running 'gcc'.


Wed, 04/17/2013 - 10:59 (Reply to #24)
Alain Cox

the .c file was downloaded when installing the plugin. There was no file "chgvirtualminpasswd" included in the download. Can I just rename the chgvirtualminpasswd.c into chgvirtualminpasswd? (maybe a stupid question as I am not familiar with running gcc)

Wed, 04/17/2013 - 12:04 (Reply to #25)

The instructions in the link you mentioned above explain all that :-)

Just make sure you follow all the steps in the instructions, and in there you'll see the exact commands you need to run (including the gcc step).


Wed, 04/17/2013 - 14:48
Alain Cox
Mon, 04/29/2013 - 05:37

Hello, I'm running Virtualmin on a Ubuntu 12.04.1 LTS Box, and I'm getting

PHP Error: Password plugin: Unable to execute /var/www/webmail/plugins/password/helpers/chgvirtualminpasswd in /var/www/webmail/plugins/password/drivers/virtualmin.php on line 73 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)

I've followed the guide

I'm running php with mod_php, and the owner is root:www-data

When running the script on shell as www-data user it says it requires Root to run.

Fri, 05/24/2013 - 14:07

Sorry to turn this topic.

My case was that have disabled the php function "exec" in "disable_functions"

Wed, 08/21/2013 - 15:23

this help fix the issue for me:, the problem is in $domain

  1. Complete these steps:
  2. Edit ..../public_html/roundcube/plugins/password/drivers/virtualmin.php

-> find the line $curdir = RCUBE_PLUGINS_DIR . 'password/helpers';

-> add these as new line $domain = 'YOUR-DOMAIN.COM'

So in case of you should have:

$curdir = RCUBE_PLUGINS_DIR . 'password/helpers';

$domain = '';

now it's working

Sat, 08/31/2013 - 01:17

Hi all, I am working to fix that server is running virtualmin with username@domain config, roundcube with password code is using latest version.

The changing password cannot work and found some issue on code. I put the echo on virtualmin.php and checking what value passed to.Found username is and nothing on domain value. For the virtualmin format, I choose 8 or 0. When the username passed to code, it cannot take username and domain from the value. And final result to execute with command is

"chgvirtualminpasswd modify-user --domain --user --pass 123456";

assuming the command should be

"chgvirtualminpasswd modify-user --domain --user keith --pass 123456";

Therefore someone caused the problem to changing password when using username@domain.

Anyone can know that it is related virtualmin config or code of password plugin problem ?

Mon, 09/02/2013 - 03:04

Hi all, Our server is running virtualmin and ubuntu server 12.04LTS. The username format is "username@domain". Roundcube also installed to server and worked fine this username format. When I want to implement change password plugin. It always return unable to change the password. Under investigate that the problem seem to be the format of username. The username is used "" from value passed in. When I configured to use username@domain in password plugin, it cannot take username and domain name from value ( Therefore, it returned error.

Anyone happened same problem and possible to fix ?

thanks keith

Fri, 10/25/2013 - 10:05 (Reply to #32)

hi keith,

I am using Centos 6.4 x64 and my password_virtualmin_format is just username ex: username=someuser

Here is the fix:

Tue, 04/21/2015 - 23:53

I'm not sure why the RC developers are attempting to reinvent the wheel. There is already a password change feature in virtualmin/usermin, why not use it?


$url = curl("$username:$oldpass@$domain:2000/changepasswd?pass1=$password&pass2=$password");

if(!strenlen($url, 'error')) { return true; } else { return false; }

What's the problem? Why is this being made so hard? Compile this binary, change permissions of this and that... We have usernames from the $_SESSION, and we have password fields. This is a lot easier than what RC is making it out to be.

Wed, 11/25/2015 - 04:11

The problem lays somwhere else. If you run the command from shell, it changes your password. Just because you run it as root.

If you run it from php or as web user from shell, you get permission denied. It's not because the chgvirtualminpasswd has permissions problem. It's because it calls /usr/sbin/virtualmin and if you cat this file, you will find this line: "/usr/sbin/virtualmin must be run as root"

So it's impossible to call the password change as user! You have to run chgvirtualminpasswd as root or "sudo" in it to run virtualmin. And this is fail at all.

Sun, 09/03/2017 - 07:37

I've had this same problem, and after days of torment, was able to have a working solution on my CentOS Linux 7.3.1611.

Thanks to this MTS Tool,, I was able to run root privileged commands from my web browser. Now my clients can change their passwords from Roundcube.

PS: The Virtualmin driver file will require some tweaking if you're using the MTS Tool.

Hope this helps someone.