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

temp-1

  🔧 vast_id Configuration Key: vast_id Description This section defines the VAST ID , a unique numeric identifier used by internal systems for asset tracking, automation, or integration with enterprise management platforms. It helps associate the server with inventory records, monitoring tools, or deployment workflows. ✅ Used during provisioning to register the system in centralized databases or orchestration systems. JSON Format json 1 "vast_id" : 12194 ✅ Can also be provided as a string: json 1 "vast_id" : "12194" Field Reference vast_id String or Integer Unique identifier for the system in VAST (Verizon Asset Systems Tracker) 12194 ✅ Must be non-empty and numeric — leading zeros may be stripped depending on system. Validations Enforced vast_id  is required and must be a non-empty string or integer Ensures the field is present and contains usable data If  vast_id  is a string, it must not be blank or whitespace-only Prevents " " , "...

temp

 {   "_id": {     "$oid": "6841e4b0fd270b2ab92d7eaa"   },   // 📌 [Auto-generated]   // Description: Unique system identifier for internal use (MongoDB ObjectId).   // Type: ObjectId (string)   // Required: No (automatically handled)   "vast_id": "21452",   // 📌 [Required]   // Description: Your unique request ID or reference number.   // Type: string   // Format: Numeric string (e.g., "21452")   // Example: "21452"   "env": "dev",   // 📌 [Required]   // Description: The environment where the VM will be deployed.   // Type: string   // Allowed values: "dev", "qa", "uat", "prod"   // Example: "dev" for development, "prod" for production   "ver": "0.2",   // 📌 [Do Not Modify]   // Description: Template version. Used by automation to ensure compatibility.   // Type: string   // Format: Semantic versioning (e.g., "...

testing

09052025 T-1 { "volume_groups" : { "vgroot" : { "vgsize" : "304G" , "fs_type" : "xfs" } } , "logical_volumes" : { "root" : { "lvroot" : { "vgname" : "vgroot" , "lvname" : "lvroot" , "lvsize" : "12G" , "mountpoint" : "/" , "purpose" : "root filesystem" , "disk" : 1 , "partition" : 2 } } , "swap" : { "lvswap" : { "vgname" : "vgroot" , "lvname" : "lvswap" , "lvsize" : "4G" , "mountpoint" : "NA" , "purpose" : "swap" , "disk" : 1 , "partit...