passwd command is used to set or reset user passwords in Linux. But sometimes while using this command, you may get an error ‘passwd: Authentication token manipulation error’. In this article, we will learn how to fix this error.
How to Fix Passwd Authentication Token Manipulation Error
Let us say you log into Linux and run passwd command to change password of user test. You are prompted for its new password and after you enter it, you see the following error message.
# su - test $ passwd test Changing password for user test Changing password for test (current) UNIX password: passwd: Authentication token manipulation error
Here are the different ways to fix the above error.
1. Reboot System
The most common way to fix this problem is to simply reboot your system
$ sudo reboot
If this does not work, then try the next approach.
2. Update PAM Module Settings
PAM (Pluggable Authentication Module) is an important Linux module that controls system-wide and application-wide user authentication. If it is not configured properly, it can lead to many authentication related issues in your system. Sometimes you may get this error because of incorrect PAM settings, which result in passwd being unable to retrieve the right authentication token.
You can check PAM settings with the following command.
$ ls -l /etc/pam.d/
To fix this problem, run the following command to reset the PAM settings.
$ sudo pam-auth-update
3. Remount Root Partition
Sometimes you may also get this error if your root partition is mounted as read only. In such cases, you cannot modify any files on your root partition and therefore passwd command will be unable to update /etc/shadow file which stores all user passwords on your system.
To fix this error, you can simply remount the root partition as read/write using the following command.
$ sudo mount -o remount,rw /
4. Update Permissions of /etc/shadow
As mentioned earlier, /etc/shadow file stores the actual passwords of all users in Linux. If it does not have the right permissions, passwd command will be unable to update it. Run the following command to check the file permission of /etc/shadow file.
$ ls -l /etc/shadow
And run the following command to update it.
$ sudo chmod 0640 /etc/shadow
5. Use fsck
You may also get this error if your disk is corrupted, or has errors in it. Run fsck command to scan your disk for errors.
Similarly, if your disk is about to be full, then Linux may prevent you from modifying any files on it, since it may increase in size. In such cases, delete a few unnecessary files & directories to free disk space and change passwords.
How to Create Multiple User Accounts in Linux
How to Find Php.ini
How to Delete Rows from Dataframe Based on Condition
How to Iterate Over Rows in Pandas in Dataframe
How to Fix SettingWithCopyWarning