Advance

Tutorial Reset Root Password on Almalinux 8.4

Tutorial Reset Root Password on Almalinux 8.4
3
(2)

AlmaLinux is a RedHat-based Linux distribution used for servers as well as desktops. Some users may forget their AlmaLinux root user password after a while. In this case, the only way to recover the root password is to reset it. In this article, we are going to teach you How to Reset Root Password on Almalinux 8.4. You can visit the packages available in Eldernode if you wish to purchase a Linux VPS server.

How to Reset Root Password on Almalinux 8.4

Recommended Article: How to install Ansible on Ubuntu 20.04

Prerequisites to Reset Root Password on Almalinux 8.4

In this section, we want to show you how to Reset the Root Password on Almalinux 8.4. The first step to do this is to restart AlmaLinux. When the boot menu appears, you must press the “e” key on your keyboard. As you can see in the image below, this opens the Grub boot editing interface:

 

Edit-Boot-Menu-AlmaLinux

 

In the next step, you need to use the arrow keys. Then you have to add the following line after /swap and before initrd. One thing to keep in mind is that if an rhg line is quiet, delete it right after /swap.

- rd.break enforcing= 0

 

Chnage-Grub-boot-configuration on almalinux

 

After completing the above steps, you can now press Ctrl+X to start the startup process. By doing this, you can start the Emergency mode scripting Shell.

 

Commands-to-reset-AlmaLinux-root-password

 

Next, you need to create read and write access to the sysroot file system using the following command:

mount -o remount,rw /sysroot

You should now be able to access the Sysroot file in a restricted environment using the following command:

chroot /sysroot

Reset Root Password on Almalinux 8.4

In the previous section, we made the necessary prerequisites to change the root password. Now you can easily reset the password by running the following command:

passwd root

The system will now ask you for a new password. The point to note is that nothing is displayed on the screen when typing the password. You must specify a strong password. This password must be at least 8 digits long, otherwise, it warns that the password is weak. Finally, press the Enter key when done.

 

Commands-to-reset-AlmaLinux-root-password

 

Exit Sysroot using the following command:

exit

As you saw a while ago, we changed access from read-only to read/write. Now you need to reset it before leaving the system:

mount -o remount,ro /sysroot

You can exit the current Switch root session and restart the system using the following command:

exit

How to Login root with a new Password

Log in with your new username and password as you view the AlmaLinux sign-in page. Note that after resetting the password, it is best to use the following command to clean the /etc/shadow system passwords that store the system password in an encrypted format. Doing so will remove any remaining input:

restorecon /etc/shadow

Conclusion

If you are locked in the AlmaLinux instance and have lost access to the root account, you will need to boot into single-user mode and reset the root password. In this article, we tried to teach you How to Reset Root Password on Almalinux 8.4.

How useful was this post?

Click on a star to rate it!

Average rating 3 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day