網頁

2012年12月2日 星期日

CentOS 6.3 x64 --- Reset root Password by booting into single user mode

Oh, My god! I forgot the root password after CentOS boot up and want to log on system. If no this account, I cannot do anything as install application or configure system later.
For resolving this problem, I dive into the Google Search to realize whether has method to do it. The answer is simple that there are three methods to resolve this problem.
   (1). CentOS boot into single user mode
   (2). Edit CentOS passwd file by Boot Disk/DVD/CDROM
   (3). Another system boot and mount CentOS as drive next to change passwd file

In the moment, I think method (1) will be simple because doesn’t use other activity or utility. So the following procedure will introduce “How to reset root password by booting into single user mode? "

Power on the CentOS machine and press any key as ‘arrow’ or ‘space bar’ keys to enter the menu when you get this message.
ScreenHunter_32
Press e key to go into the second menu for editing the command (# 1)ScreenHunter_18
Move cursor to the second line (kernel…) next to press e key once again
ScreenHunter_21
The screen will show up this command line and cursor will locate on the end of the line.
ScreenHunter_22
Press key and move cursor to “… ro root=…/VolGroup-lv_root…” this location
ScreenHunter_24
Add single key word next to press Enter key to return to “GNU GRUB Menu
ScreenHunter_25
Press b key to reboot CentOS
ScreenHunter_26Now it will stop at “#" command line
ScreenHunter_27
Type “passwd” to reset new password for root
ScreenHunter_29
Reboot this again
ScreenHunter_30
So does that root can log on to use new password now.
ScreenHunter_31

Reference:
(# 1) If it is booted at GRUN and type a key to modify kernel argument, we can append 1 or S key at the end of “…rhgb quiet” next to press Enter key to boot into single user mode.
ScreenHunter_35
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.