SlideShare a Scribd company logo
How To Reset Root Password on RHEL 7
i | P a g e
Table of Contents
Overview.......................................................................................................................................................1
Applies To......................................................................................................................................................1
Pre-requisites................................................................................................................................................1
Choose Kernel - Core.................................................................................................................................1
Find Kernel Entry – ro ...............................................................................................................................2
Modify Kernel Entry – init.........................................................................................................................2
Change Root – sysroot..............................................................................................................................3
Set – Root Password .................................................................................................................................4
Relebal Filesystem – SELinux ....................................................................................................................4
How To Reset Root Password on RHEL 7
1 | P a g e
Overview
If you happen to forgot root password of the server. You have to login to the server with single user and
edit the kernel entry and boot and change the root password.
Applies To
CentOS 7, RHEL 7; Tested on CentOS 7
Pre-requisites
Console Access to the system.
Choose Kernel Entry - Core
In order to reset the root password, you need to reboot the server and choose “Core” kernel entry in the
“boot” menu option.
When the boot menu is shown; choose the kernel entry as below and press key “e” as shown below.
CentOS Linux (3.10.0-229.11.1.el7.x86_64) 7 (Core)
Note: Boot screen will be shown only for 5 seconds.
How To Reset Root Password on RHEL 7
2 | P a g e
Find Kernel Entry – ro
In the “Edit Kernel” option, navigate till you find text “ro” after root device mapper.
Modify Kernel Entry – init
Next, you need to modify the kernel entry as below; which will instruct the kernel to start into “sh”.
rw init=/sysroot/bin/sh
After modifying, press “Ctrl + x”, kernel will be instructed to start in single user mode.
How To Reset Root Password on RHEL 7
3 | P a g e
Change Root – sysroot
Execute chroot command or interactive shell with special root directory. Run the command as below;
chroot /sysroot
How To Reset Root Password on RHEL 7
4 | P a g e
Set – Root Password
Now, After running the “chroot” command; in the shell prompt run the command “passwd” along with
login username “root” as below to set new password for the root user.
After command execution, Enter the new password and re-enter the new password again.
passwd root
Relabel Filesystem – SELinux
At boot time, init.rc checks for the existence of /.autorelabel. If this file exists, SELinux performs a
complete file system relabel (using the /sbin/fixfiles -f -F relabel command), and then
deletes /.autorelabel.
To perform the check run the command and reboot the server; after rebooting you can login into the
server with newly set password.
touch /.autorelabel
reboot

More Related Content

PDF
How to Fix Duplicate Packages in YUM on CentOS 7
PDF
How To Install and Configure GNome on CentOS 7
PDF
VMWare Tools Installation and Troubleshooting Guide
PDF
How To View Current Execution Policy PowerShell
PDF
How To Configure SNMP Logging on RHEL 7
PDF
How To Manage Yum Cache
PDF
How to Manage journalctl Logging System on RHEL 7
PDF
How To Manage Linux User on RHEL 7
How to Fix Duplicate Packages in YUM on CentOS 7
How To Install and Configure GNome on CentOS 7
VMWare Tools Installation and Troubleshooting Guide
How To View Current Execution Policy PowerShell
How To Configure SNMP Logging on RHEL 7
How To Manage Yum Cache
How to Manage journalctl Logging System on RHEL 7
How To Manage Linux User on RHEL 7

What's hot (20)

PDF
How to Upgrade Openfire on CentOS 7
PDF
How To Install and Configure Chrony on RHEL 7
PDF
TFTP Installation Configuration Guide
PDF
Nginx bind() to 0.0.0.0:9080 failed
PDF
How To Install and Configure Screen on CentOS 7
PDF
How To Install and Use ABRT CLI on RHEL 7
PDF
How To Install and Generate Audit Reports in CentOS 7 or RHEL 7
PDF
How To Manage Services on RHEL 7 or CentOS 7
PDF
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
PDF
How to Install MariaDB Server or MySQL Server on CentOS 7
PDF
How To Protect SSH Access with Fail2Ban on RHEL 7
PDF
Configure Run Levels RHEL 7 or CentOS 7
PDF
Install and Configure RSyslog – CentOS 7 / RHEL 7
PDF
How to Install Configure and Use sysstat utils on RHEL 7
PDF
How to Change Hostname in CentOS 7 or RHEL 7
PDF
How To Configure Nginx Load Balancer on CentOS 7
PDF
How To Audit Server Login and Shutdown or Reboot Activity
PDF
How To Install OpenFire in CentOS 7
PDF
How To Install CentOS 7
PDF
How To Install and Configure SNMP on RHEL 7 or CentOS 7
How to Upgrade Openfire on CentOS 7
How To Install and Configure Chrony on RHEL 7
TFTP Installation Configuration Guide
Nginx bind() to 0.0.0.0:9080 failed
How To Install and Configure Screen on CentOS 7
How To Install and Use ABRT CLI on RHEL 7
How To Install and Generate Audit Reports in CentOS 7 or RHEL 7
How To Manage Services on RHEL 7 or CentOS 7
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
How to Install MariaDB Server or MySQL Server on CentOS 7
How To Protect SSH Access with Fail2Ban on RHEL 7
Configure Run Levels RHEL 7 or CentOS 7
Install and Configure RSyslog – CentOS 7 / RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7
How to Change Hostname in CentOS 7 or RHEL 7
How To Configure Nginx Load Balancer on CentOS 7
How To Audit Server Login and Shutdown or Reboot Activity
How To Install OpenFire in CentOS 7
How To Install CentOS 7
How To Install and Configure SNMP on RHEL 7 or CentOS 7
Ad

Similar to How To Reset root Password on CentOS 7 (20)

PDF
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
PDF
How To List Nginx Modules Installed / Complied on CentOS 7
PDF
How To Install and Configure Splunk on RHEL 7 in AWS
PDF
How To Check file exists and Delete PowerShell
PDF
Rhel5 essentials preview
DOCX
Runs scored by Players Analysis with Flume and Pig
PDF
Linux_kernelmodule
PDF
Securing optimizing linux red hat edition
PDF
red_hat_enterprise_linux-7-system_administrators_guide-en-us.pdf
PDF
003 red hat-enterprise_linux-6-dm_multipath-en-us
PDF
Installing & Configuring IBM Domino 9 on CentOS
PDF
Plesk 8.2 for Windows Backup and Restore Utilities ...
PDF
Plesk 8.2 for Windows Backup and Restore Utilities ...
PDF
Installation Guide
PDF
Deploy hadoop cluster
PDF
PDF
How to Configure OpenFiler for NFS Share
PDF
L.A.M.P Installation Note --- CentOS 6.5
DOCX
Installation and Configuration
PDF
B12303
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7
How To Install and Configure Splunk on RHEL 7 in AWS
How To Check file exists and Delete PowerShell
Rhel5 essentials preview
Runs scored by Players Analysis with Flume and Pig
Linux_kernelmodule
Securing optimizing linux red hat edition
red_hat_enterprise_linux-7-system_administrators_guide-en-us.pdf
003 red hat-enterprise_linux-6-dm_multipath-en-us
Installing & Configuring IBM Domino 9 on CentOS
Plesk 8.2 for Windows Backup and Restore Utilities ...
Plesk 8.2 for Windows Backup and Restore Utilities ...
Installation Guide
Deploy hadoop cluster
How to Configure OpenFiler for NFS Share
L.A.M.P Installation Note --- CentOS 6.5
Installation and Configuration
B12303
Ad

More from VCP Muthukrishna (17)

PDF
How To Connect to Active Directory User Validation
PDF
How To Connect To Active Directory PowerShell
PDF
How To List Files on Remote Server - PowerShell
PDF
How To List Files and Display In HTML Format
PDF
How To Check and Delete a File via PowerShell
PDF
How To Setup SSH Keys on CentOS 7
PDF
How To Install and Configure Open SSH Server on Ubuntu
PDF
Windows PowerShell Basics - How To List PSDrive Info
PDF
Windows PowerShell Basics – How To Create powershell for loop
PDF
How To Construct IF and Else Conditional Statements
PDF
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
PDF
How To Create Power Shell Function Mandatory Parameter Value
PDF
How To Create PowerShell Function
PDF
How To Disable IE Enhanced Security Windows PowerShell
PDF
How To Check IE Enhanced Security Is Enabled Windows PowerShell
PDF
How To Install and Configure Salt Master on Ubuntu
PDF
How To Find Package Installation Date on RHEL 7
How To Connect to Active Directory User Validation
How To Connect To Active Directory PowerShell
How To List Files on Remote Server - PowerShell
How To List Files and Display In HTML Format
How To Check and Delete a File via PowerShell
How To Setup SSH Keys on CentOS 7
How To Install and Configure Open SSH Server on Ubuntu
Windows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics – How To Create powershell for loop
How To Construct IF and Else Conditional Statements
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create Power Shell Function Mandatory Parameter Value
How To Create PowerShell Function
How To Disable IE Enhanced Security Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Install and Configure Salt Master on Ubuntu
How To Find Package Installation Date on RHEL 7

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Machine Learning_overview_presentation.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Spectroscopy.pptx food analysis technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Heart disease approach using modified random forest and particle swarm optimi...
Mushroom cultivation and it's methods.pdf
Encapsulation_ Review paper, used for researhc scholars
A comparative analysis of optical character recognition models for extracting...
Univ-Connecticut-ChatGPT-Presentaion.pdf
Machine learning based COVID-19 study performance prediction
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine Learning_overview_presentation.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Getting Started with Data Integration: FME Form 101
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Spectroscopy.pptx food analysis technology
Unlocking AI with Model Context Protocol (MCP)
Spectral efficient network and resource selection model in 5G networks
SOPHOS-XG Firewall Administrator PPT.pptx
Mobile App Security Testing_ A Comprehensive Guide.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
NewMind AI Weekly Chronicles - August'25-Week II
Heart disease approach using modified random forest and particle swarm optimi...

How To Reset root Password on CentOS 7

  • 1. How To Reset Root Password on RHEL 7 i | P a g e Table of Contents Overview.......................................................................................................................................................1 Applies To......................................................................................................................................................1 Pre-requisites................................................................................................................................................1 Choose Kernel - Core.................................................................................................................................1 Find Kernel Entry – ro ...............................................................................................................................2 Modify Kernel Entry – init.........................................................................................................................2 Change Root – sysroot..............................................................................................................................3 Set – Root Password .................................................................................................................................4 Relebal Filesystem – SELinux ....................................................................................................................4
  • 2. How To Reset Root Password on RHEL 7 1 | P a g e Overview If you happen to forgot root password of the server. You have to login to the server with single user and edit the kernel entry and boot and change the root password. Applies To CentOS 7, RHEL 7; Tested on CentOS 7 Pre-requisites Console Access to the system. Choose Kernel Entry - Core In order to reset the root password, you need to reboot the server and choose “Core” kernel entry in the “boot” menu option. When the boot menu is shown; choose the kernel entry as below and press key “e” as shown below. CentOS Linux (3.10.0-229.11.1.el7.x86_64) 7 (Core) Note: Boot screen will be shown only for 5 seconds.
  • 3. How To Reset Root Password on RHEL 7 2 | P a g e Find Kernel Entry – ro In the “Edit Kernel” option, navigate till you find text “ro” after root device mapper. Modify Kernel Entry – init Next, you need to modify the kernel entry as below; which will instruct the kernel to start into “sh”. rw init=/sysroot/bin/sh After modifying, press “Ctrl + x”, kernel will be instructed to start in single user mode.
  • 4. How To Reset Root Password on RHEL 7 3 | P a g e Change Root – sysroot Execute chroot command or interactive shell with special root directory. Run the command as below; chroot /sysroot
  • 5. How To Reset Root Password on RHEL 7 4 | P a g e Set – Root Password Now, After running the “chroot” command; in the shell prompt run the command “passwd” along with login username “root” as below to set new password for the root user. After command execution, Enter the new password and re-enter the new password again. passwd root Relabel Filesystem – SELinux At boot time, init.rc checks for the existence of /.autorelabel. If this file exists, SELinux performs a complete file system relabel (using the /sbin/fixfiles -f -F relabel command), and then deletes /.autorelabel. To perform the check run the command and reboot the server; after rebooting you can login into the server with newly set password. touch /.autorelabel reboot