改密失败提示:

passwd: Authentication token manipulation error
passwd: password unchanged

image.png


原因:

用户权限不足


解决步骤:

 1.使用chattr -i 去除 /etc/shadow 和 /etc/passwd两个文件的 只读属性(即:文件不能被删除、改名、设定链接关系,同时不能写入或新增内容,与chmod的只读属性不一样)

    a. chattr -i /etc/shadow

    b. chattr -i /etc/passwd

    *c. lsattr -v /etc/passwd  #此步只是为了查看文件属性信息,可以省略

image.png


2.更改密码

    a. pwconv  #开启投影密码修改,只允许系统管理者读取,同时把原密码置换为"x"字符,有效的强化了系统的安全性。

    b. passwd

image.png


3.还原属性

  a. chattr +i /etc/passwd

  b. chattr +i /ect/shadow

image.png


知识扩展:

/ect/passwd : 存放用户的账号与密码信息,密码为“*”号

/ect/shadow:存放加密密码,与/ect/passwd账号对应

/ect/passwd 与 /etc/shadow 文件详解:https://blog.csdn.net/yaofeino1/article/details/54616440

chattr命令: https://www.linuxprobe.com/linux-chattr-root.html

lsattr命令:http://www.runoob.com/linux/linux-comm-lsattr.html

pwconv命令: http://www.runoob.com/linux/linux-comm-pwconv.html