1. On Linux, resetting the password for the root account can be done easily using single-user boot mode
Join the channel Telegram of the AnonyViet 👉 Link 👈 |
1.1 On GRUB:
When the kernel selection screen to boot appears, press “e” to enter the edit mode of boot parameters.
Select the line containing the kernel parameter. Eg:
kernel /boot/vmlinuz-2.6.11 ro root=LABEL=/
Press “e” to enter the editing window.
Move to the end of the line, add the word “single”. Press Enter to save changes. Type “b” to boot with single-user mode.
You will get the root’s shell without being asked for a password. Now just with the command “passwd” you can easily change the root password already! Done type “exit” to continue the system boot normally.
2.2 On LILO:
If you use LILO in graphic mode, when the LILO screen appears press “Ctrl-x” to exit the graphical interface and enter the “boot:” prompt. Knock on
linux single
After that, you will be able to access the root account without any password! Change the password as above.
2. So anyone sitting on your Linux box can gain root privileges? Yeah. Solution: Set a password for the GRUB/LILO boot loader.
2.1 Protecting GRUB
Do not allow editing GRUB config to enter single mode.
•Generate grub password hashed with md5Type /sbin/grub-md5-crypt Type in Grub password
We get a hash value
•Edit GRUB config file: /boot/grub/grub.conf: Below the timeout line add: password –md5
Bonus: Must enter GRUB password to boot HDH:
•Type below the title line: lock
•Type password –md5 in
2.2 Protecting LILO
Must enter password to boot:
•Edit file /etc/lilo.conf: before image, add password=
•Run /sbin/lilo –v –v to update lilo
Protect specific images for which: before image=/boot/vmlinuz- line password=
Allow the user to boot but do not give additional parameters to enter a single-user without a password: add the restricted line below the password.
Please set an additional password for GRUB/LILO to avoid losing control of the system accidentally.