How to prevent other people from changing your root password?

Now that you've seen how simple it is to get access to a Linux system without any passwords, you'd surely be surprised at this flaw. That's what I thought when I came to know about this exploit. Actually, you have to instruct the boot loader (LILO or GRUB) not to permit people from passing arbitrary arguments to the kernel without first authenticating themselves. In short, you have to set a "Boot Loader Password" which will be required when you pass any arguments to the kernel. Now what if you forget that too... brutha, then you need a betta storehouse up there!!

This is how you go about it. Make the following changes in /etc/lilo.conf with your favourite text editor. I use emacs.

# emacs /etc/lilo.conf
Search for the "image=" entry for your kernel. It'll look something like this:
image=/boot/vmlinuz-2.4.7-10
label=linux
initrd=/boot/initrd-2.4.7-10.img
read-only
root=/dev/hda1
edit it so that it looks like this:
image=/boot/vmlinuz-2.4.7-10
label=linux
initrd=/boot/initrd-2.4.7-10.img
read-only
root=/dev/hda1
restricted
password=yourpass
The password you provide above, will be the one you have to key in whenever you try to pass any boot time parameter to the kernel. Now run "lilo" so that it can update itself with the new configuration.
# lilo
Voila!! now you can reboot and try out the Brand New Hackers-Can-Eat-Their-Shit boot loader!!

Note: It's always a good idea to make the /etc/lilo.conf file only root readable, so that normal users can't peek-a-boo at your boot loader password.
# chown root.root /etc/lilo.conf
# chmod 400 /etc/lilo.conf

Frequently Used Options
See also common Linux Commands

Have a Linux Issue?
Do you have a Linux Question?

Linux Home: Linux System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.