In this article, you will learn, how to recover Root Password in CentOS 6 or other Red hat based Linux OS. #centlinux #linux #recovery
Table of Contents
Problem Statement
As we know that, the root is the superuser in every Linux distros. We often come to situations, where, the root password is not available. Although it is trivial to reset root password, if you have a user with sudo rights. otherwise it becomes a little tricky. To reset the password of root user we required physical access to the machine or in case of virtual machines we need console access via respective VM Manager.
In this post, we will recover root password in CentOS 6 Server.
Recommended Online Training: Learn Bash Shell in Linux for Beginners
![How to recover Root Password in CentOS 6 1 745772 0021](https://img-c.udemycdn.com/course/480x270/745772_0021.jpg)
Read Also: Create OpenLDAP Address Book in CentOS 7
Recover Root Password in CentOS 6
Start your RHEL 6 machine and try to login with root user.
![CentOS 6 Startup CentOS 6 Startup](https://centlinux.com/wp-content/uploads/2024/02/image-304.png)
![CentOS 6 CLI Login Prompt CentOS 6 Login](https://centlinux.com/wp-content/uploads/2024/02/image-305.png)
We could’t login to our RHEL 6 machine, because we didn’t know the root password.
Login with another user and restart the machine.
![CentOS 6 CLI Reboot CentOS 6 Reboot](https://centlinux.com/wp-content/uploads/2024/02/image-306.png)
At GRUB boot menu, press e to edit the menu entry.
![CentOS 6 GRUB Menu GRUB Menu 1](https://centlinux.com/wp-content/uploads/2024/02/image-307.png)
![CentOS 6 Edit GRUB Menu GRUB Menu 2](https://centlinux.com/wp-content/uploads/2024/02/image-308.png)
Go the line that contains kernel command and press e to edit it.
![CentOS 6 GRUB Edit Kernel Command GRUB Menu 3](https://centlinux.com/wp-content/uploads/2024/02/image-309.png)
![CentOS 6 GRUB Edit Kernel Command (Current) Edit GRUB Menu 1](https://centlinux.com/wp-content/uploads/2024/02/image-310.png)
Append 1 at the end of this command and press <ENTER> to save changes.
![CentOS 6 GRUB Edit Kernel Command (New) Edit GRUB Menu 2](https://centlinux.com/wp-content/uploads/2024/02/image-311.png)
![CentOS 6 GRUB Menu (New) GRUB Menu 4](https://centlinux.com/wp-content/uploads/2024/02/image-312.png)
Press b to boot the machine.
![CentOS 6 Single User CLI Linux Single User Mode](https://centlinux.com/wp-content/uploads/2024/02/image-313.png)
The system now boots into Single User mode, without asking for any password.
Use the passwd command to reset the password of root.
![CentOS 6 Single User CLI (passwd) recover Root Password in CentOS 6](https://centlinux.com/wp-content/uploads/2024/02/image-314.png)
Restart the machine and login with new password.
![CentOS 6 Single User CLI (reboot) Reboot CentOS 6](https://centlinux.com/wp-content/uploads/2024/02/image-315.png)
![CentOS 6 CLI (root user) CentOS 6 Login as root](https://centlinux.com/wp-content/uploads/2024/02/image-316.png)
root password of your CentOS / RHEL 6 machine has been recovered.
Read Also: How to reset Root Password in CentOS 7
If you are new to Linux and facing difficulty in working at Linux Bash prompt. We recommend that, you should read The Linux Command Line, 2nd Edition: A Complete Introduction by William Shotts.