Skip to content


Howto set password for grub & single user mode

Hi,

Today i am working on my pc and i thought if i set password for single user mode then any one can’t entered inside and change the root password.

First open terminal

if you are not login with root then login as a root

Note:- take backup of your grub.conf file becuase if something goes wrong then you can recove it.

[root@linuxdude ~]# cp /boot/grub/grub.conf  /boot/grub/old.grub.conf

[root@linuxdude ~]# grub-md5-crypt

password:******
Retype password:******
$1$bDAVbCOBwY67c3liHQq5GCU0

it will print your password in md5 format.You have to just copy this md5 password and past into your grub.conf file.

[root@linuxdude ~]# vi /boot/grub/grub.conf

—————————————————————————

#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,5)/grub/splash.xpm.gz
hiddenmenu
title Fedora (2.6.23.17-88.fc7)
password –md5  $1$bDAVbCOBwY67c3liHQq5GCU0
root (hd0,5)
kernel /vmlinuz-2.6.23.17-88.fc7 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.23.17-88.fc7.img
title Fedora (2.6.21-1.3194.fc7)
root (hd0,5)
kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.21-1.3194.fc7.img
title Other
rootnoverify (hd0,4)
chainloader +1

—————————————————————————-

You have successfully proctected your Grub.

To Make Single User Mode Password Protected, Copy that md5 encrypted password which was generated by grub-md5-crypt and paste it exact after splashimage line.

[root@linuxdude ~]# vi /boot/grub/grub.conf

—————————————————————————

#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,5)/grub/splash.xpm.gz
password –md5  $1$bDAVbCOBwY67c3liHQq5GCU0
hiddenmenu
title Fedora (2.6.23.17-88.fc7)
password –md5  $1$bDAVbCOBwY67c3liHQq5GCU0
root (hd0,5)
kernel /vmlinuz-2.6.23.17-88.fc7 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.23.17-88.fc7.img
title Fedora (2.6.21-1.3194.fc7)
root (hd0,5)
kernel /vmlinuz-2.6.21-1.3194.fc7 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.21-1.3194.fc7.img
title Other
rootnoverify (hd0,4)
chainloader +1

—————————————————————————-

You have successfully proctected your single user mode.

****************************************************************************

p-root :)

Enjoy Linux !!!

Posted in Linux tutorials.

Tagged with .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. mark says

    I bookmarked this site, Thank you for good job!



Some HTML is OK

or, reply to this post via trackback.