RedHat Linux is a worldwide used OS in servers and networking devices. Red Hat lists Adobe, Ampersand and many among the top 500 fortune companies. They list Cisco, Dell, HP, and IBM as partners. Resetting the root password of RHEL is not a difficult task but rather you need to know 4 commands and you are into the root account!
Root account in Linux is that user which has unlimited power in Linux without any restrictions. This article revolves about how one can reset the root password of RedHat/CentOS Linux. We are working here with the latest version of RHEL which is RHEL 8.
STEP 1: Start your OS and you will see this screen as soon you start your OS.
Press e, a new screen will come as shown below.
The place where green arrow is there, type
Press Ctrl+X to continue that process.
When BIOS loads up your OS, in between that rd.break will stop that process there and enforcing will stop the security of RHEL which is SELINUX from any intervention.
STEP 2: you will get this screen like shown below
You are in Emergency mode now. This is the main screen and most of the work will be done here.
mount -o remount, rw /sysroot/
and enter the desired password twice.
>you will get a bash shell from where you can change the root password as per your own choice.The command for changing password in Linux is passwd username. now type
Congrats, you have successfully changed the root password of RHEL without any intervention of SELinux(Security-Enhanced Linux) and you can login into root account with that password.
But wait, after logging in the SElinux becomes active again and encrypts your /etc/passwd file which is a highly secured file where all users and link to their passwords are kept.
STEP 3:So, a last command to decrypt that file
Follow all the steps in order explained and you will be easily able to reset root account password.
- Reset a lost Linux administrative password and Explanation
- Resetting a root password in Linux without external media
- reset command in Linux with Examples
- Linux Virtualization : Linux Containers (lxc)
- How to store a password in database?
- Password Strength Indicator using jQuery
- One Time Password (OTP) algorithm in Cryptography
- Node JS | Password Hashing with Crypto module
- Create a password generator using shell scripting
- Run commands as root with sudo
- Find root of a number using Newton's method
- Root to leaf path product equal to a given number
- How to bind to port number less than 1024 with non root access?
- Sort the path from root to a given node in a Binary Tree
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.