Reset Forgotten Root Password in RHEL/CentOS

To reset root password we have to boot into single user mode.

1.Interrupt the computer while booting at GRUB.

linux_boot

2.Type ‘a’ to append kernel argument or ‘e’ to edit.here we can type either ‘a‘ or ‘e’

3. Type  1 or single  selinux=0 to disable selinux(if required) at the end of boot arguments and press Enter to boot into single user mode. for example single selinux=0 or 1 selinux=0

4.Now your system will boot into single user mode. to Check the runlevel type runlevel command.output will be like ‘1 S’ ie single usermode.

5.Now Type passwd command and change you root password.

6.Once you change you password reboot the system or type init 6 to reboot or init 5 to boot to Full multi-user GUI mode login.we also use telinit runlevel command to boot into a particular run level.

#   0 – halt
#   1 – Single user mode
#   2 – Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 – Full multiuser mode(Text Console ie without GUI)
#   4 – unused
#   5 – X11 (Multiuser Mode but with single GUI ie only one user can access GUI at time)
#   6 – reboot

the above runlevels can be found in /etc/inittab file.

Advertisements
This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s