How To Reset The Forgotten Root Password On CentOS 7
Hello there,
In this article, I will show you the server I used recently and forgot the password. I used Centos7 as the operating system.
First off, let’s shut down our server. Then, at the bottom of the opening screen, ” Press ‘e’ to edit the selected item or ‘c’ for a command prompt.” Let’s look at the part.
Let’s press ‘e’ ıp and continue.
Let’s go down with the arrow directions on the screen and find the relevant line.
Delete the ro part you see on the screen (linux16 / vmlinuz the end of the line)
We write rw init = / sysroot / bin / sh and change it. It then exit this section with the Ctrl + x key combination.
In this screen;
chroot /sysroot
passwd root
“you can enter your new password…”
Finally, due to selinux settings, you should enter the following command. In this way, the new password will be active-tagged. At the command prompt, commands such as reboot-shutdown will not work. Don’t forget to exit chroot.
I hope it has been a useful article.
