现在的位置: 首页 > 综合 > 正文

solaris 10 root忘记密码的解决方法

2012年03月21日 ⁄ 综合 ⁄ 共 1522字 ⁄ 字号 评论关闭
我的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成功登陆!

抱歉!评论已关闭.