Hello again! In this article we will show you how to reset the root password. but in the article we bring you today we will see how to do it in a simpler way. We will see how to change root password from GRUB.
Before describing the process I put the video where everything is explained:
The steps are simple, as follows
Edit grub entry
To edit the grub entry, the first thing to do is to reboot the system. When the list of kernels in GRUB appears, click on the kernel you want to edit and press on the one you want to edit and press the “e” key. After doing this we go to the kernel parameters line, at the beginning of the line will appear linux16, at the end of the line, you must add
init=/bin/bash and press
This will load the bash shell immediately instead of loading the init process. This avoids asking for login.
Inside the bash shell
After loading the shell, run
su -, This way we will have loaded all the environment variables, etc. to work normally.
Then you must run
mount -rw -o remount / to make the root filesystem R/W and not read-only.
then we can execute the command
passwd to change the root password.
En el caso de que sea un sistema con SElinux habilitado, debe ejecutar
touch /.autorelabel para actualizar las políticas de SElinux.
After doing this we can execute the command
reboot -f. After executing the reboot it will take a little longer than usual because it has to update the SElinux policies and will generate two reboots. After this, you can access the system with the new root password.