Change Password
ERROR: That username is NOT VALID.\n";
} elseif($_POST['new'] != $_POST['confirm']) {
echo "ERROR: Passwords DO NOT MATCH.
\n";
} else {
$user = escapeshellarg($_POST['username']);
$current = escapeshellarg($_POST['current']);
$new = escapeshellarg($_POST['new']);
$out = array();
$result = exec("chpasswd $user $current $new", $out);
if($result == "passwd: password updated successfully") {
echo "SUCCESS: Password changed.
\n";
} else {
echo "ERROR: Failed to change password.
\n";
}
}
}
?>
Notes
Your password will fail to change for one of the following reasons:-
- Your current password is wrong.
- Your new password is too short.
- Your new password is too simple and easily guessed.