知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

linux root密码忘记了,如何找回来?

发布时间:2014-09-05 13:25:47作者:知识屋

<span style="color: rgb(0, 0, 0); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 14px; line-height: 25px;">&nbsp; &nbsp;好久没有玩LINUX了,今天小编公司的服务器挂了,就进去看看,可恶的是小编忘记了公司服务器的密码了,还是LINUX的呢,麻烦出来了,怎么办呢?小编就研究了一下,一个早上才知道怎么找回来,下面就介绍到3种方法可以找回来的,具体如下:</span> <div style="word-wrap: break-word; color: rgb(0, 0, 0); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 14px; line-height: 25px;"> <p style="word-wrap: break-word; margin: 0px; padding: 0px;"><a href="http://www.zhishiwu.com/plugin.php?id=iplus_seolinks:links&amp;url=ZGF0YS9hdHRhY2htZW50L3BvcnRhbC8yMDE0MDIvMjYvMjE1NDIyazN4cWM3N2V4NHBlcWlweS5wbmc=" style="word-wrap: break-word; color: rgb(51, 51, 51); text-decoration: none;" target="_blank"><img src=http://www.zhishiwu.com/uploadfile/2014/0302/20140302041449392.png" style="word-wrap: break-word; border: none; max-width: 620px;" /></a></p> <div style="word-wrap: break-word;"> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;"><strong style="word-wrap: break-word; margin: 0px; padding: 0px;">linux root密码找回方法一</strong></p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第1步:用grub引导系统时:在出现grub画面时,用上下键选中你平时启动linux的那一项(别选dos哟),然后按e键</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第2步:再次用上下键选中你平时启动linux的那一项(类似于kernel /boot/vmlinuz-2.4.18-14 ro root=LABEL=/),然后按e键</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第3步:修改你现在见到的命令行,加入single,结果如下:</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  kernel /boot/vmlinuz-2.4.18-14 single ro root=LABEL=/ single</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第4步:回车返回,然后按b键启动,即可直接进入linux命令行.</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第5步:使用以下命令&ldquo;vi /etc/shadow&rdquo;将第一行,即以root开头的一行中root:后和下一个:前的内容删除,第一行将类似于root::......保存</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  vi /etc/shadow</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第6步:reboot重启,root密码为空。</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">&nbsp;</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;"><strong style="word-wrap: break-word; margin: 0px; padding: 0px;">linux root密码找回方法二</strong></p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第1步:在系统进入单用户状态,直接用passwd root去更改。</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第2步:用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法如下:</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  cd /mnt mkdir hd mount -t auto /dev/hdaX(原来/分区所在的分区号) hd cd hd chroot ./ passwd root</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">&nbsp;</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;"><strong style="word-wrap: break-word; margin: 0px; padding: 0px;">linux root密码找回方法三</strong></p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第1步:在系统进入单用户状态,直接用passwd root去更改。</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第2步:用安装光盘引导系统,进行linux rescue状态,将原来/分区挂接上来,作法如下:</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  cd /mnt mkdir hd mount -t auto /dev/hdaX(原来/分区所在的分区号) hd cd hd chroot ./ passwd root</p> <p style="word-wrap: break-word; margin: 0px; padding: 0px; color: rgb(51, 51, 51); font-family: Verdana, Arial, Helvetica, sans-serif; line-height: 24px;">  

第3步:将本机的硬盘拿下来,挂到其他的linux系统上,</p> </div> </div> <br />

(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜