In this article, we will see how to reset the root password of our Linux operating systems. This will be useful if we forget or do not know the password of our operating system.
Of course, we need to be physically next to our server for this process. That’s why we have to care about the physical security of my servers in order not to hack our servers.
1. As a first step, if our system is on, we shut it down and when starting again we press any key of the keyboard and enter our boot options.
2. When our operating system is turned on, we select the last kernel module running from the boot options and we need to press the “e” key of our keyboard.
3. In order to open the kernel module that we selected in the previous step in our operating system, in the “single” mode before loading, we edit our boot option by pressing the “e” key of the keyboard.
4. Let’s go to the last line of the kernel module boot option opened in the operating system, add the “single” parameter as below and press enter.
5. The process of editing the kernel module of the operating system has been completed. We press the “b” key of the keyboard while the kernel module is selected to open the system with the “single” parameter entered previously.
6. The operating system now opens in the “single” mode that we have entered and the line “#” comes up for us to perform the command operations.
7. While the operating system is at the command line, we run the “passwd” command and create a new password. After entering the new password, we need to restart our operating system. Another issue we need to pay attention to here is our keyboard option, “Q” in English. Therefore, we must know this when creating our password and enter our password accordingly. Otherwise, when our system is turned on, we may not be able to log in if we have a keyboard selected as “Q” in another language and we have not entered it in our password accordingly.
- Code used to reset your password
Changing password for user root.
New password: **********
Retype new password: **********
passwd: all authentication tokens updated successfully.
To restart the operating system.
The processes in this article have been implemented in the “Oracle Enterprise Linux” operating system. These processes are the same in Red Hat derivative (CentOS etc.) operating systems.
I hope it was a useful article.