Skip to main content

RHEL CentOS & Fedora: How to Reset Forgotten Root Password


RHEL CentOS & Fedora: How to Reset Forgotten Root Password

Resetting the forgot root user password usually only takes a few simple steps that will help you through the process of resetting the root password and logging in with the new password.

To begin, restart your machine and select the kernel you want to boot into from the boot grub menu by pressing the 'e' key on your keyboard.


The following kernel boot parameters will appear on the next screen; locate the line that begins with (kernel=) and add the parameter (rd.break) at the end as indicated, then click Ctrl + x.


You'll be taken to emergency mode on the next screen; hit Enter to enter the shell prompt. Now, double-check that you have read and write permissions on the sysroot directory. It's mounted in read-only mode by default, which is denoted by the letter ro.

Remount the sysroot directory with read and write rights, then double-check the permissions. The permissions have changed from ro (read-only) to rw (read and write) this time, as shown.

Then, using the following command, mount the root file system in read and write mode.

Then, using the passwd command, change the root password to the new one and confirm it.

You've successfully reset your root user password at this point. The only thing left is to rename all of the files to reflect the correct SELinux contexts.

To start the SELinux relabeling process, type exit and then log out.


This usually takes a few minutes, after which the system will reboot and prompt you to log in as root using the new password.

Completed!


That’s it, the session was completed. 





































Comments

Popular posts from this blog

Configuring Multipathing and Setting Up Storage on a Linux Server:

Ensuring high availability and redundancy in your storage environment is crucial for maintaining system reliability. Multipathing allows you to distribute I/O across multiple paths, providing fault tolerance and improved performance. This guide covers the entire process from configuring multipathing to setting up physical volumes (PVs), volume groups (VGs), and logical volumes (LVs) with different sizes.  Prerequisites:   Before you begin, make sure you have the following:  Administrative access to the server  Multipath tools installed on your server  Basic understanding of Linux commands  Step-by-Step Guide:   1. Install Multipath Tools:   Ensure that you have the necessary multipath tools installed: # sudo yum install device-mapper-multipath yum: Package manager for RHEL-based distributions.  install: Command to install a package.  device-mapper-multipath: Name of the package to be installed.  2. Enable and Start t...

Configure SSH Between Compute Nodes in OpenStack:

To perform operations like live migration or resizing an instance between compute nodes in OpenStack, SSH key-based authentication must be configured between all the nodes. This ensures smooth communication for moving instance disks without encountering errors like "Permission denied." Follow these steps to configure SSH between compute nodes:  Step 1: Obtain or Generate SSH Key Pair: On the first compute node, either use the existing SSH key pair located in /root/.ssh/id_rsa (private key) and /root/.ssh/id_rsa.pub (public key) , or generate a new key pair if none exists: # ssh-keygen -t rsa -b 2048 This will create a private key (id_rsa) and a public key (id_rsa.pub) in the .ssh directory.  Step 2: Disable SELinux (Optional): If you are using SELinux, switch to permissive mode temporarily to avoid permission issues: # setenforce 0 Step 3: Enable Login for the nova User: Ensure that the nova user has shell access: # usermod -s /bin/bash nova Switch to the nova user...

What is the OSI Model, and how does it work?

  What is the OSI Model, and how does it work? OSI - Open Systems Interconnection                1. The Open Systems Interconnection (OSI) model is a virtual model for describing the internal structure and technologies of a computer system.                2. Network communication is divided into seven tiers according to the OSI Model. These layers are helpful in detecting network problems.                3. A lot of unneeded work can be avoided if the problem can be focused down to one specific layer of the model. Seven layers of the OSI Model 7. Application layer                1. In the OSI model, the Application Layer is the layer closest to the end user.                2. It receives data directly from users and shows the information to them.           ...