Problem Install Roundcube plugin - Change Password

Thanks to this link here from Virtualmin

http://www.virtualmin.com/system/files/roundcube_virtualmin_password_change.txt

Thanks!

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
http://www.virtualmin.com/system/files/roundcube_virtualmin_password_change.txt

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.

Sorry to turn this topic.

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

Using andreychek’s instructions at the following links.

http://www.virtualmin.com/node/23427#comment-105978
https://www.virtualmin.com/node/19391#comment-105946

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

this help fix the issue for me: http://www.virtualmin.com/node/23015, the problem is in $domain

  1. Complete these steps: http://www.virtualmin.com/files/roundcube_virtualmin_password_change.txt
  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 example.com you should have:

$curdir = RCUBE_PLUGINS_DIR . ‘password/helpers’;

$domain = ‘example.com’;

now it’s working

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 keith-abc.com 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 keith-abc.com --pass 123456”;

assuming the command should be

“chgvirtualminpasswd modify-user --domain abc.com --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 ?

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 “keith-abc.com” from value passed in. When I configured to use username@domain in password plugin, it cannot take username and domain name from value (keith-abc.com). Therefore, it returned error.

Anyone happened same problem and possible to fix ?

thanks
keith

hi keith,

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

Here is the fix:

http://trac.roundcube.net/changeset/065fdbaa6560e017d87f96414a2146ff6bc84969/github/plugins/password/drivers/virtualmin.php

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 domain.name"

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

Thanks
Regards

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

First, follow these steps: http://www.virtualmin.com/files/roundcube_virtualmin_password_change.txt

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.

from:

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

to:

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)
To:

‘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 domain.com or the name of your server.
in my case, I changed the line:

$domain = $rcmail->user->get_username(‘domain’);

To:

$domain = $_SERVER[‘SERVER_NAME’];

After the change, I receive the error:

No user named name-mydomain.com was found in the server mydomain.com

To fix, I modified the line:

$username = escapeshellcmd($username);

To:

$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.

Do these instructions still apply to roundcube version 1.0.3 ??

Thanks

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.

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?

Example:

$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.

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.

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.

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, https://github.com/merlinthemagic/MTS, 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.

Many thanks, I think this is the complete step to fix the problem Error: Could not save new password.

The 'message' => "Password plugin: Unable to execute $curdir/chgvirtualminpasswd".print_r($output,true) are very helpful because from there we know what the real problem is.