centos修改root密码passwd

技术问题

centos修改root密码passwd

2025-04-10 09:24


centos修改root密码passwd: Authentication

                                            




云服务器修改密码时提示错误[root@WS10111509 ~]# passwd rootChanging password for user root.New UNIX password:Retype new UNIX password:passwd: Authentication token manipulation error

2,修改权限时提示错误[root@WS10111509 ~]# chmod 755 /etc/passwdchmod: changing permissions of `/etc/passwd’: Operation not permitted

3,同步/etc/passwd 和/etc/shadow出错#pwconvpwconv: can’t lock passwd file

4,操做方法。检查:# fuser -u /etc/passwd //查看是否有写入权限# lsof |grep passwd //查看是否有写入权限# ll /etc/.pwd.lock //查看是否有此文件# df -i //查看是否空间被占满# lsattr /etc/shawr //查看是否被写保护

lsattr /etc/passwd—i———- //被标记了i属性

chattr -i /etc/passwdchmod 755 /etc/passwd

lsattr /etc/shawr—-i——– //被标记了i属性

chattr -i /etc/shawchmod 755 /etc/shaw

#pwconv 同步/etc/passwd 和/etc/shadow

pawsswd root 不会出错了。修改密码后

5,加回保护

#chattr命令只能管理员使用,重新保护passwd文件chattr +i /etc/passwdchattr +i /etc/shaw

 

还有一种可能就是有的系统是限制了5天内不能修改密码,也会出现这样的错误。


label :
  • centos修改root密码passwd: Authentication