centOS root密码忘记怎么办?

来源:互联网 发布:ubuntu g 编译命名 编辑:程序博客网 时间:2024/05/22 00:35

1.开机启动引导目录Booting CentOS(2.6.18-238.el5) in 3 seconds ... 时,按 e。

2.然后看到下一个画面,选择“CentOS(2.6.18-238.el5)” ,按 e.

3.之后看到另一个画面,有三个选项

root(hd0,0)

kernel/vmlinuz-2.6.18-238.el5 ro root=LABEL=rhgb quiet

initrd/initrd-2.6.18-238.el5.img

使用上下光标键,选择第二个(kernel/vmlinuz-2.6.18-238.el5 ro root=LABEL=rhgb quiet)

然后按 “e”

4.执行完以上步骤后看到以下画面  

  gurb edit>kernel /vmlinuz-2.6.18-238.el5 ro root=LABEL=/ rhgb quiet, 在rhgb quiet后加“空格”,然后输入“single”,或者直接输入数字“1”回车确定。

5.操作完后出现如下画面

root(hd0,0)

kernel/vmlinuz-2.6.18-238.el5 ro root=LABEL=rhgb quiet 1

initrd/initrd-2.6.18-238.el5.img

光标默认选择第二项

6.按“b”键,重新引导

7.重新引导后,屏幕显示sh-3.2#,光标停留在后面,然后输入:passwd root 命令。

changing password for user root.

new UNIX password:(输入新密码)

Retype new UNIX password:(第二次输入新密码)

两次密码输入一致后,屏幕出现:passwd:all authentication tokens updated successfully. 

sh-3.2#在光标后输入:reboot重新引导系统即可。