Home >System Tutorial >LINUX >Solution to error reporting when root changes password under Linux
When I was preparing to change the root user password of the Linux system today, I executed passwd root. The following situation occurred and the password change failed:
# passwd root Changing password for user root. New password: Retype new password: passwd: Authentication token manipulation error
After searching on the Internet, some said it was caused by running out of inodes, that is, the root partition was full, but executing df -i did not find the reason:
# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda2 6406144 58534 6347610 1% / tmpfs 8242797 2 8242795 1% /dev/shm
Continue to look for answers and check the system files /etc/passwd and /etc/shadow related to user passwords according to online cases. It is found that the permissions of these two files have the i option. The query results are as follows:
# lsattr /etc/passwd —-i——–e- /etc/passwd # lsattr /etc/shadow —-i——–e- /etc/shadow
Note: In the Linux system, if the file has the i option, it means that no modifications can be made to it, which also leads to the failure to change the password.
To solve this problem, you need to execute the chattr -i command to revoke the i permissions of the above two files
# chattr -i /etc/passwd # chattr -i /etc/shadow # lsattr /etc/passwd ————-e- /etc/passwd # lsattr /etc/shadow ————-e- /etc/shadow
Then execute passwd to change the password,
# passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully.
After changing the password, for security reasons, you can execute chattr i to add i permissions to the user password system file
# chattr +i /etc/passwd # chattr +i /etc/shadow # lsattr /etc/passwd —-i——–e- /etc/passwd # lsattr /etc/shadow —-i——–e- /etc/shadow
The above is the detailed content of Solution to error reporting when root changes password under Linux. For more information, please follow other related articles on the PHP Chinese website!