Hi friends,
I have a little problem with the password plugin. I see many people it is the same, i receive the error message "password could not be saved". i´m trying to do it with chpassword and in config.inc.php i have:
$rcmail_config['password_driver'] = 'chpasswd';
And in chpasswd.php:
function password_save($currpass, $newpass)
{
$cmd = rcmail::get_instance()->config->get('password_chpasswd_cmd');
$username = $_SESSION['username'];
$handle = popen($cmd, "w");
fwrite($handle, "$username:$newpass\n");
if (pclose($handle) == 0) {
return PASSWORD_SUCCESS;
}
else {
raise_error(array(
'code' => 600,
'type' => 'php',
'file' => __FILE__, 'line' => __LINE__,
'message' => "Password plugin: Unable to execute $cmd"
), true, false);
}
return PASSWORD_ERROR;
I have checked the open tickets but i can´t find anything.
Anybody can help me?
Whats in your error log?
Thanks for your reply!!!
I forgot the log :-[
[04-Apr-2012 10:18:31 +0200]: PHP Error: Password plugin: Unable to execute sudo /usr/sbin/chpasswd 2> /dev/null in /var/www/html/webmail/plugins/password/drivers/chpasswd.php on line 30 (POST /webmail/?_task=settings&_action=plugin.password-save?_task=&_action=)
maybe I should mention that i´m working with Centos 5.7
Thanks in advance
It looks like the user who runs the script (most likely apache) doesn't have the permissions to run the sudo command.
It could make sense, but i allow user apache to execute chpasswd but still doesn´t work. Still i have the same error message in log :(
This is the way i do it:
I execute visudo and add the line apache ALL=NOPASSWD: /usr/sbin/chpasswd
also execute usermod -s /bin/bash apache
Any ideas?
Thanks for everything
I just to saw another thing. I have logged into the bash with the apache user and wen i tried execute /usr/sbin/chpasswd i received the follow message:
chpasswd can't lock password file.
do not know if this error is related to what happens
Not sure, has the error changed?
it hasn´t changed . Its the same error.....Unable to execute..... Also i gave root permisions to user apache in sudoers without success....
Hmm, maybe RoundCube isn't running under apache, how do you have the users setup on the system?
Hello;
I just ran into this problem, and figured it out by looking at the Apache error log.
### log sample ###
sudo: sorry, you must have a tty to run sudo
### end log sample ###
What I needed was to edit sudoers and comment out the line which had 'requiretty'
I hope this helps.
Solution:
modify sudoers, use visudo, only add:
apache ALL=NOPASSWD: /usr/sbin/chpasswd
Defaults:apache !requiretty
don't change any lines