修改root密码时出现错误passwd: Authentication token

修改linux root密码时出现错误passwd: Authentication token manipulation error
发生该错误原因是:
1、分区没有空间导致。
2、/etc/passwd 和/etc/shadow不同步
但是这次上面两条却行不通,通过df查看根分区还有40%剩余。
 
1、尝试修改密码,出现错误
# passwd
Changing password for user root.
New UNIX password: 
BAD PASSWORD: it is WAY too short
Retype new UNIX password: 
passwd: Authentication token manipulation error
2、同步/etc/passwd 和/etc/shadow出错
 #pwconv
pwconv: can't lock passwd file
3、看权限没有异常,也没有进程锁定该文件
# ll /etc/passwd
-rwxr--r--  1 root root 2752 Dec 31 17:29 /etc/passwd
# fuser -u /etc/passwd
# lsof |grep passwd
4、cp lock文件出错,提示空间不足
# cp /tmp/.pwd.lock /etc/
cp: cannot create regular file `/etc/.pwd.lock': No space left on device
5、上面的错误惊醒了我,查看确实是inode满了,删除无用的文件
#df -i
Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda5            2562240 2562240       0  100% /
/dev/sda1              50200      47   50153    1% /boot
/dev/sda2            51300000      12 51299988    1% /data/cache1
/dev/sdb1            51300000 7080311 44219689   14% /data/cache2
/dev/sdb2            9863168      11 9863157    1% /data/proclog
none                  215907       1  215906    1% /dev/shm
/dev/sda3            3842720  305795 3536925    8% /usr
/dev/sda7            3162112    7893 3154219    1% /var
6、再次修改密码仍然出错,于是尝试修改/etc/passwd也出现错误
# chmod 777 /etc/passwd
chmod: changing permissions of `/etc/passwd': Operation not permitted
7、执行chattr 
#chattr -i  /etc/passwd
# lsattr -v /etc/passwd 
2095582053 ------------- /etc/passwd
# chattr -i  /etc/shadow
8、同步文件
pwconv
9、成功修改密码
passwd 
Changing password for user root.
New UNIX password: 
BAD PASSWORD: it is WAY too short
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.

你可能感兴趣的:(linux)