How to Reset Linux Root Password for CentOS, Fedora, and RHEL

Did you forget the root password of your CentOS server? Do you want to learn how to change the root password of RHEL? You are in the right place.

Updated: 05 Mar, 23 by Susith Nonis 5 Min

List of content you will read in this article:

If you are looking to get into the world o web hosting or server management, there in one thing that absolutely cannot be left out in the current digital space: Linux. While most prefer Windows to perform their daily tasks and internet browsing, there is no doubt that Linux dominates the OS market for servers.

Today we will shortly discuss Linux and some of its most popular distributions. This will be followed by a detailed step-by-step tutorial on how to reset Linux root user passwords on CentOS, Fedora, and Red Hat Enterprise Linux. While these operating systems are different, working around them is quite similar. If you have a good understanding of working with one of them, then it won’t be too difficult for you to work with the rest. 

 

Linux has been around for multiple decades and is now being used as the go-to operating system for enterprise infrastructures. Since the 90s’ first release, Linux has come a long way and now powers more than 70% of the internet as we know it. Thus, there are many Linux distributions that have come to fruition. 

For server management purposes, system administrators tend to prefer Linux distributions as they provide good security and flexibility. The free and open-source characteristic of Linux is also very appealing to many expert computer and server users. Let us now discuss a few popular Linux distributions.

CentOS

Starting from the star of this blog, CentOS. Typical CentOS users are organizations and individuals that do not need strong commercial support in order to achieve successful operations. CentOS is a 100% compatible rebuild of the Red Hat Enterprise Linux, in full compliance with Red Hat's redistribution requirements. CentOS is for people who need enterprise-level operating system stability without the cost of certification and support.

RHEL

RHEL or Red Hat Enterprise Linux is a Linux distribution developed by Red Hat for the commercial market. All of Red Hat's official support and training, together with the Red Hat Certification Program, focuses on the Red Hat Enterprise Linux platform. Red Hat uses strict trademark rules to restrict free re-distribution of their officially supported versions of Red Hat Enterprise Linux but still freely provides its source code. Third-party derivatives can be built and redistributed by stripping away non-free components like Red Hat's trademarks. One such example is CentOS.

Fedora

Fedora is a Linux distribution developed by the community-supported Fedora Project which is sponsored primarily by Red Hat, a subsidiary of IBM, with additional support from other companies. Fedora contains software distributed under various free and open-source licenses and aims to be on the leading edge of free technologies. Fedora has 5 different editions which focus on different aspects:

  1. Workstation - focus on personal computing
  2. Server - focus on servers
  3. CoreOS - focus on cloud computing
  4. Silverblue - focus on an immutable desktop specialized to container-based workflows
  5. IoT - focus on IoT devices

The main thing is that when you are working on changing settings or dealing with core components, you are only allowed to do this by using the root account. But what can you do if you forgot the Linux root password? This is a problem but not to worry. In this tutorial, we will go through the easiest way to reset the Linux root password. 

The methods mentioned in this guide can be used to recover the CentOS root password, reset the root password of Fedora and recover the RHEL root password. 

Let’s get to it!

 

Before we begin, you should take a full backup of your system and files. This tutorial was made using CentOS, however, the method will work for RHEL, Fedora, and most Linux distributions

Step 1: Reboot your system and when the system is booting, press the arrow keys or space bar.

Step 2: Once you hit the arrow keys, you will see something like the following image. Select the CentOS version that you are looking to reset the root password in by using the up and down arrow keys

Step 3: Now, press A on your keyboard. You will see a window as shown below.

Step 4: Next, press the Space key and type in 1; then press the Enter key.

After following these steps, your system will boot into single-user mode.

Step 5: In order to check what we have done so far was accurate type runlevel. If the result is 1 s we can proceed further.

Step 6: Now, it is time to change the password by typing passwd. Enter the new password. Note that you will not see the password that you are typing. This is a security measure of all Linux distros. 

Congratulations are in order; you have successfully reset the root password of CentOS.

 

Within this article, we provided a brief introduction about Linux and its distributions, as well as a simple step-by-step tutorial on how to reset the root user password. Let us know in the comment section below if it worked and don't forget to share it with your friends. Don’t have a CentOS device? You can get your very own CentOS powered Virtual Private Server from Monovm. 

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.