How To Reset Forgotten Root Password on RedHat 6 / CentOS 6

Sep 8, 2015 Linux

RedHat 6 / CentOS 6 system gives us the opportunity to reset root password in case we forget it, on condition that we have a direct access to the machine on which we want to reset root password. Password can be reset after booting the system into single-user mode.

Steps:

1. Reboot the system

2. At the screen: “Booting Red Hat Enterprise Linux…” or “Booting CentOS…” press any key to display GRUB menu.

3. At the GRUB menu select kernel version and press a to append to the list of kernel parameters:

grub_menu

4. Add s at the end of the kernel parameters list (to boot to the single-user mode) and press Enter:

kernel_parameters_edit

5. Reset root password at the single-user mode prompt:

[root@tuxfixer /]# passwd
Changing password for user root.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

6. Switch to graphic mode (runlevel 5) or reboot:

[root@tuxfixer /]# init 5

or

[root@tuxfixer /]# reboot

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.