I have the following php script for password change: <?php error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE); ini_set('display_error', true);
$cmd = 'sudo -u root sh -c \'/usr/bin/echo "username:pass" | sudo /usr/sbin/chpasswd 2>&1\'';
exec($cmd,$output,$return_val);
print_r($output);
echo $return_val;
?>
This script show error in browser:
pam_chauthtok() failed, error: [1] => Authentication token lock busy [2] => chpasswd
But the command
sudo -u root sh -c '/usr/bin/echo "username:pass" | sudo /usr/sbin/chpasswd 2>&1'
work fine. Can please someone give me a tip, why I get in browser the error above?
Filesystem is in rw mode. Files /etc/{passwd,shadow} have a correct permissions
Thank you in advance