我的root本來是沒有密碼的。在控制台用root登陸了,執行了sys-unconfig,重新設定了一下系統資訊。密碼依然留空。(sys-unconfig會清除所有的設定資訊,包括root密碼,奇怪的是卻不會刪除其它使用者的密碼。)再登陸時,突然要我輸入密碼。
上哪兒去偷呢?想哭~
查看soliaris的文檔817–1985–15 SystemAdministration Guide:Basic Administration 的Managing UserAccounts and Groups
(Overview)部分,裡面有說明:
Password information is stored as follows:
· In the passwd file when you are using NIS or NIS+
· In the /etc/shadow file when you are using /etc files
· In the people container when you are using LDAP
The fields in the shadow file are separated by colons and contain the following information:
username:password:lastchg:min:max:warn:inactive:expire
password Might contain the one of following entries:
· A13-character encrypted user password
· The string *LK*, which indicates an inaccessible account
· The string NP, which indicates no password for the account
也就是說,空密碼的root,在/etc/shadow中應該有如下資訊:
root:NP:6445::::::
我看了我的shadow檔案
#vi /etc/shadow
root::6445::::::
按照solaris10在其文檔817-1758 System Administration Guide: Advanced Administration裡提供的的解決辦法。
What to Do if You Forgot Root Password
If you forget the root password and you cannot log into the system, you will have to:
* Stop the system by using the keyboard stop sequence.
* Boot from a boot or install server or from a local CD-ROM.
* Mount the root (/) file system.
* Remove the root password from the /etc/shadow file.
* Reboot the system.
* Log in and set root's password.
還描述得甚為詳細:
# vi shadow
(Remove root's encrypted password string)
這裡為空白就沒有密碼了,然而登陸不上卻是事實。改成root:NP:6445::::::(先用命令"chmod +rw shadow"將檔案改為可讀寫)。還要問我要密碼。
又想了一個辦法。我還有一個建立的帳戶cracker。設了密碼為401448ff。其在shadow中的資訊為:
cracker:y5mLgGTOxxDdM:13723::::::
將其密碼部分複製到root的密碼部分
root:y5mLgGTOxxDdM:6445::::::
重啟,用401448ff成功登陸!