Encountering the “passwd: Authentication token manipulation error” while trying to change a user’s password on a Linux system can be frustrating. However, there are several solutions you can try to resolve this issue and successfully change the password.
Use the sudo command: Instead of directly using the
passwd command to change the password, try running it with sudo privileges. You can do this by using the following command:
$ sudo passwd
<username> with the actual username for which you want to change the password. By entering this command, you will be prompted to enter a new password for the specified user.
Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully
Use the passwd command with the -e option: The -e (expire) option is used to expire the password, forcing you to change it upon next login. Use the following command:
$ sudo passwd -e <username>
Again, replace with the desired username.
Expiring password for user . passwd: Success
Check the /etc partition: Ensure that the partition containing the /etc/passwd and /etc/shadow files is mounted in read-write mode. If the partition is mounted as read-only, changing the password will not be possible. You can use the mount command to check the status of partitions.
$ mount | grep -E '/etc/passwd|/etc/shadow'
If the partition is mounted as read-only, you should remount it as read-write or address any issues with the partition.
/dev/sda1 on /etc type ext4 (rw)
Check the system disk: If the partition containing the /etc/passwd and /etc/shadow files is full, it can result in an error when changing the password. Check the available disk space on the system using the df -h command. If the partition is full, free up space by deleting unnecessary files or expand the partition.
$ df -h
Filesystem Size Used Avail Use% Mounted on /dev/sda1 20G 18G 1.3G 94% /
Verify the /etc/passwd and /etc/shadow files: Check if these files are correct and not corrupted. Errors in these files can lead to the “passwd: Authentication token manipulation error” issue. If the files are damaged, you can restore them from a backup or regenerate them.
/etc/passwd: file format: ASCII text /etc/shadow: file format: ASCII text
By following these steps, you should be able to change the password without encountering the “passwd: Authentication token manipulation error” message. If the problem persists, further investigation and troubleshooting on your system may be required.