Hi all i really need help! System Linux Fedora 9 with sendmail + Dovecot IMAP/POP3 Server all users local... so i think only way is chpasswd Driver... when i press save i get message that i cant save new password, in logs i got error:
[09-Sep-2010 11:20:50 +0300]: PHP Error: Password plugin: Unable to execute echo 'xoxma:123456' | sudo /usr/sbin/chpasswd 2> /dev/null; echo $? in /usr/share/roundcubemail/plugins/password/drivers/chpasswd.php on line 0 (POST /mail/?_task=settings&_action=plugin.password-save?_task=&_action=)
how to fix it and where is a problem??? :( maybe you could give advice to try another password driver....???
I found one fix but it didnt help me...
Update: I have the chpasswd driver working with 0.4-beta on Fedora 11 with Apache. My users are local users.
Here's how I got it to work:
1: enable the "password" plugin that comes with roundcube.
2: set it to use the chpasswd driver
3: type visudo
4: Add the following lines in this order(replace "apache" with the account that your apache install runs under and make sure you have the correct path to the chpasswd program):
Defaults:apache !requiretty
apache ALL=NOPASSWD: /usr/sbin/chpasswd
No ONE can help??? i could pay some $ for help!!! :(
Same problem here!
Any help would be appreciated!
+1
Same problem here. It look like a permissions error but I, too, cannot figure out which file and setting.
Hello all,
I had the same problem here. I want to setup chpasswd to change linux system password with the 'chpasswd' driver.
Now after my own changes to the chpasswd.php file, I got it working !!
Here is the solution. The lines of php code UNDER the comment '// REMOVED' are the original, I have outcomment the to keep the original in the php file just in case.
The codeline under the line with comment '// FIX...' is the replacement for the original line.
What I did was in the first place, reconstruct what should be happening when executing the change password command on the system. As root:
#echo "test:111" | chpasswd
where test is my mail user and 111 is the new password for this mail user.
In the driver php file ('chpasswd.php' in the plugins/password/driver folder) the change password function is opening a pipe and then the user's name and new password are written to this opened pipe. Unfortunately this is not working the way it should, and I can not figure out why yet. But my fix make the password plugin with chpasswd as driver working.
In this scenario, you also have to config the /etc/sudoers file, so the user your webserver runs under (and therefore roundcube), can execute the chpasswd binary on your system as root. I use Debian lenny over here, and my /etc/sudoers line looks like this:
www-data ALL=NOPASSWD: /usr/sbin/chpasswd
HERE IS THE SOLUTION
for chpasswd.php file (in the plugins/password/drivers folder):
------------------------------------------------------------------
function password_save($currpass, $newpass)
{
$username = $_SESSION['username'];
// REMOVED (ORIGINAL LINE):
// $cmd = rcmail::get_instance()->config->get('password_chpasswd_cmd');
// FIX:
$cmd = "echo '".$username.":".$newpass."' |" . rcmail::get_instance()->config->get('password_chpasswd_cmd');
$handle = popen($cmd, "w");
// REMOVED (ORIGINAL LINE):
// fwrite($handle, "$username:$newpass");
// FIX:
fwrite($handle, "");[/SIZE]
-----------------------------------------------------
Other lines of code do not have to be altered.
Any feedback if it helped will be appreciated !
Cheers,
Erik de Keijzer
The Netherlands
UPDATE:
Tpday I tried the new 0.5.1 version of Roundcube, and the password plugin in this version is working 100%. So my modification in the driver source is not necessary.
Greetings,
Erik
Ok, I just found an issue with the chpasswd script.
If your roundcube configuration is setup to use %u but they login with the @domainname, the session(username) is apparently causing the chpasswd script to try and use chpasswd
[email protected] instead of chpasswd user.
Can someone help with a quick fix?
I am on ver .7.1
Just a quick guess off the top of my head (un tested) but how about changing the line:
$username = $_SESSION['username'];
To:
$username = explode('@', $_SESSION['username']);
And then change the line:
$cmd = "echo '".$username.":".$newpass."' |" . rcmail::get_instance()->config->get('password_chpasswd_cmd');
To:
$cmd = "echo '".$username[0].":".$newpass."' |" . rcmail::get_instance()->config->get('password_chpasswd_cmd');
That did it, Thank You!
Hi edkedk,
I tried your solution for my server based on CentOS 6, but the chpasswd driver still not works...
Test echo... from root is ok.
In the /etc/sudoers file I wrote:
apache ALL=NOPASSWD: /usr/sbin/chpasswd
I changed lines in the chpasswd.php how you have posted.
Have you some ideas?
Hi all/
In CentOS SELinux is the problem. It is a violation of SELinux policy to write in /etc by http_t security context. This module needs to do that.
You can try to make a policy or disable SELinux (I'm not a fan of that).