今天準備修改Linux系統的root用戶密碼時,執行passwd root,出現了以下情況,修改密碼失敗:
# passwd root
Changing password for user root.
New password:
Retype new password:
passwd: Authentication token manipulation error
到網上搜了下,有的說是因為inodes用完,也就是根磁區滿了引起的,但執行df -i并非找個原因:
# df -i
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda2 6406144 58534 6347610 1% /
tmpfs 8242797 2 8242795 1% /dev/shm
繼續找答案,按照網上的案例檢查用戶密碼相關的系統檔案/etc/passwd和/etc/shadow,發現這兩個檔案權限有i選項,查詢結果如下:
# lsattr /etc/passwd
—-i——–e- /etc/passwd
# lsattr /etc/shadow
—-i——–e- /etc/shadow
備注:在Linux系統里,檔案有i選項則表示不得對其做任何的修改,這也就導致了修改密碼失敗,
要解決該問題,則需要執行chattr -i命令,將以上兩個檔案i權限撤銷掉
# chattr -i /etc/passwd
# chattr -i /etc/shadow
# lsattr /etc/passwd
————-e- /etc/passwd
# lsattr /etc/shadow
————-e- /etc/shadow
然后再執行passwd修改密碼,
# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
修改完密碼后,為了安全起見,可以執行chattr +i為用戶密碼系統檔案增加i權限
# chattr +i /etc/passwd
# chattr +i /etc/shadow
# lsattr /etc/passwd
—-i——–e- /etc/passwd
# lsattr /etc/shadow
—-i——–e- /etc/shadow
原文來自:http://www.yunweipai.com/archives/18897.html
本文地址:https://www.linuxprobe.com/linux-root-passwd.html編輯員:郭建鵬,審核員:逄增寶

本文由博客一文多發平臺 OpenWrite 發布!
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/253777.html
標籤:其他
上一篇:linux內核開發
下一篇:linux 遠程連接工具
