SlideShare a Scribd company logo
1 of 8
Download to read offline
 
   
Resetting Lost root Password in RHEL7 & CentOS7 
In this howto you will learn the process of resetting the lost root password in 
RHEL7 & CentOS7 
In this password recovery process you should pass the ​rd.break​ parameter 
as a kernel argument at the​ ​Stage2​ ​menu of ​GRUB2​ boot loader which is the 
default boot loader of RHEL7 & CentOS7 systems.  The documents was 
created using RHEL7 VM which was running on a KVM hypervisor.  
Reboot your ​Linux system​ ​ and when it display the following ​GRUB2 Stage2
menu​ ​screen press ​ESC​ ​key and then type letter ​“e”​ to edit the menu entries. 
Look at the red box in this screen beloe. You have to be ultra quick here as it 
passes this screen in just ​5​ seconds. 
 
Then you will see the following screen. The ​linux16​ ​grub command is our 
concern here as ​GRUB​ is using this command to load the kernel and to pass the 
parameters required by the kernel at this stage.  
 
1 | Page 
 
Delete all the additional parameters which is marked using a red color polyline 
as shown in the above screen upto ​ro (read-only)​ ​parameter which is used 
to mount your system's root (/)  filesystem read only at this stage. The end 
result should look like below. 
 
Next you need to type​ ​rd.break​ parameter after the above ​ro​ parameter and 
the end result should look like the screen below. 
2 | Page 
 
Next press the ​Ctrl+x​ key sequence to continue the boot process further.  
The ​rd.break​ parameter instructs the Kernel  to break the boot process 
before it passes the control to the ​systemd​ master process and break the boot 
process after mounting initial ramdisk ​(​initrd​)​ as Linux ​/​ ​filesystem. At this 
stage you can recover the lost ​root password​ and carry out  other 
troubleshooting tasks if required. 
The system will show the following screen. At the command line type ​mount 
command to view mounted file systems at this stage.  
 
Observe the  red color box below in the screen below. You will observe that 
your system’s ​root (/)​ ​file system on ​/dev/vda1​ ​has been mounted on 
/sysroot​ ​in read-only ​(​ro​)​ mode. The​ ​/sysroot​ mount point is a directory 
in  the ramdisk which is currently being used as ​/​ filesystem.  
3 | Page 
 
Before we further proceed we need to remount​ ​/sysroot​ ​in read-write ​(​rw​) 
mode so that we can write our modification to the disks. Observe the screen 
below. 
 
As demonstrated in the red box of the above screen execute the command to 
remount​ ​/sysroot​ in ​rw​ mode. 
# mount -o remount,rw /sysroot
# mount | grep sysroot
Executing ​mount | grep sysroot​ ​command you can verify  that ​/sysroot​ is 
now mounted in ​rw​ mode.  
Observe the next screen to find out how to change your root password as 
“Postroll”​. ​This command changes the root password non-interactively​.
# echo Postroll | passwd --stdin root.
4 | Page 
 
It is important to check whether your ​root​ user has expired. You can observe 
the following screen to understand this process.  
This is optional, but it will be useful to know how to activate an expired root 
account.  You do not require the following steps if the root account haven’t set 
to expire.  
 
Observe the above screen to understand that the ​root​ account has been 
expired on ​1​st​
January 1970​.  You can run the following command to reset 
the expiry date for the root account.  
# chage -E -1 root
To learn more about the syntax of the above command use​ ​man chage
command and search for option ​-E​.
Observe the following screen to find whether you have reset ​root​ account 
expiry properly. 
5 | Page 
 
Run ​chage -l root​ command as shown in the above screen and you will 
observe that Account expiration set to ​never​ which is the default setting for 
the ​root​ user account. 
In this ramdisk environment SELinux in ​disabled​ mode. Observe the screen 
below.  
 
As shown in the above screen run ​getenforce​ command and you will 
observe that SELinux in ​Disabled​ mode.  
Running ​ls -Z /etc/shadow​ ​command as shown in the above screen you 
have observed that there is no SELinux label for this file. 
Running  ​cat /etc/sysconfig/selinux​ ​command above you have observed 
that SELinux will be in ​enforcing​ ​mode when the system is running at next 
reboot. This requires a relabeling of the filesystem at next reboot. This can be 
achieved by creating a blank file named ​.autorelabel​ ​in​ ​/​ ​directory. Run 
the following command. 
6 | Page 
# ​touch /.autorelabel
Then type the following command to exit from the chroot environment. 
# ​exit
Execute the exit command again to reboot the system. 
# ​exit
Observe the following screen. 
 
Observe the red box in the screen below. You will see that the system is 
re-labeling. The time taken for this process will depend on the number of files 
and directories in your system. 
 
Once the labeling is over the system will reboot again and  you should be able 
to successfully login to root account with the password ​“​Postroll​”.
Author: Chinthaka Deshapriya (RHCA). 
Last modified:  20​th​
 May, 2017.  
Inquires: +94-766-783-783 and 
7 | Page 
 
8 | Page 

More Related Content

Similar to Rhel7 cent os7-reset-root-password-v1

Grub2 and troubleshooting_ol7_boot_problems
Grub2 and troubleshooting_ol7_boot_problemsGrub2 and troubleshooting_ol7_boot_problems
Grub2 and troubleshooting_ol7_boot_problemsTommy Lee
 
Oracle e business-suite_r12_installation_guide_step_by_step_on_linux
Oracle e business-suite_r12_installation_guide_step_by_step_on_linuxOracle e business-suite_r12_installation_guide_step_by_step_on_linux
Oracle e business-suite_r12_installation_guide_step_by_step_on_linuxmoh_arifay
 
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardLab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardVincent Claes
 
Important cisco-chow-commands
Important cisco-chow-commandsImportant cisco-chow-commands
Important cisco-chow-commandsssusere31b5c
 
How to solve misalignment lun netapp on linux servers by Ivan
How to solve misalignment lun netapp on linux servers by IvanHow to solve misalignment lun netapp on linux servers by Ivan
How to solve misalignment lun netapp on linux servers by IvanIvan Silva
 
Linux boot process – explained
Linux boot process – explainedLinux boot process – explained
Linux boot process – explainedLinuxConcept
 
2009 reborn card plus version
2009 reborn card plus version 2009 reborn card plus version
2009 reborn card plus version cordobaboxeador
 
9adcab7c 1 crash
9adcab7c 1 crash9adcab7c 1 crash
9adcab7c 1 crashPrezMan3141
 
Adding System Call to Kernel
Adding System Call to KernelAdding System Call to Kernel
Adding System Call to KernelMuhammad Bilal
 
101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and rebootAcácio Oliveira
 

Similar to Rhel7 cent os7-reset-root-password-v1 (20)

Grub2 and troubleshooting_ol7_boot_problems
Grub2 and troubleshooting_ol7_boot_problemsGrub2 and troubleshooting_ol7_boot_problems
Grub2 and troubleshooting_ol7_boot_problems
 
Oracle e business-suite_r12_installation_guide_step_by_step_on_linux
Oracle e business-suite_r12_installation_guide_step_by_step_on_linuxOracle e business-suite_r12_installation_guide_step_by_step_on_linux
Oracle e business-suite_r12_installation_guide_step_by_step_on_linux
 
Linux Booting Process
Linux Booting ProcessLinux Booting Process
Linux Booting Process
 
Intro xp linux
Intro xp linuxIntro xp linux
Intro xp linux
 
Testps
TestpsTestps
Testps
 
lec4.docx
lec4.docxlec4.docx
lec4.docx
 
2- System Initialization in Red Hat
2- System Initialization in Red Hat2- System Initialization in Red Hat
2- System Initialization in Red Hat
 
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter boardLab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
Lab: Installation of Xilkernel on Xilinx Spartan 3E Starter board
 
Important cisco-chow-commands
Important cisco-chow-commandsImportant cisco-chow-commands
Important cisco-chow-commands
 
How to solve misalignment lun netapp on linux servers by Ivan
How to solve misalignment lun netapp on linux servers by IvanHow to solve misalignment lun netapp on linux servers by Ivan
How to solve misalignment lun netapp on linux servers by Ivan
 
Linux boot process – explained
Linux boot process – explainedLinux boot process – explained
Linux boot process – explained
 
Password Recovery
Password RecoveryPassword Recovery
Password Recovery
 
2009 reborn card plus version
2009 reborn card plus version 2009 reborn card plus version
2009 reborn card plus version
 
9adcab7c 1 crash
9adcab7c 1 crash9adcab7c 1 crash
9adcab7c 1 crash
 
Adding System Call to Kernel
Adding System Call to KernelAdding System Call to Kernel
Adding System Call to Kernel
 
101 1.2 boot the system
101 1.2 boot the system101 1.2 boot the system
101 1.2 boot the system
 
101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot101 1.3 runlevels , shutdown, and reboot
101 1.3 runlevels , shutdown, and reboot
 
Linux
LinuxLinux
Linux
 
OS_lab_file.pdf
OS_lab_file.pdfOS_lab_file.pdf
OS_lab_file.pdf
 
lab1
lab1lab1
lab1
 

Recently uploaded

Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsLeah Henrickson
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandIES VE
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxjbellis
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 

Recently uploaded (20)

Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on ThanabotsContinuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
Continuing Bonds Through AI: A Hermeneutic Reflection on Thanabots
 
Using IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & IrelandUsing IESVE for Room Loads Analysis - UK & Ireland
Using IESVE for Room Loads Analysis - UK & Ireland
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
Vector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptxVector Search @ sw2con for slideshare.pptx
Vector Search @ sw2con for slideshare.pptx
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 

Rhel7 cent os7-reset-root-password-v1