passwd: Permission denied
So, the other day, I encountered the following error while attempting to update the user administrator password and also when attempting to add a new user named Tom.
root@zmatech:~# passwd administrator
passwd: Permission denied
passwd: password unchanged
root@zmatech:~#
root@zmatech:~# adduser tom
Adding user `tom' ...
Adding new group `tom' (1002) ...
Adding new user `tom' (1002) with group `tom' ...
Creating home directory `/home/tom' ...
Copying files from `/etc/skel' ...
passwd: Permission denied
passwd: password unchanged
Try again? [y/N]
I resolved this by doing the following:
- Open the file /etc/pam.d/common-password
# vi /etc/pam.d/common-password
- Look for the following line:
password [success=2 default=ignore] pam_unix.so obscure sha512
Now, if your entry look exactly like mine, then change success=2 to success=1 then save the file. If you see success=3, then change it to success=2 and save your file.
That's it, now you should be able to change a password and add new user.