Sunday, March 30, 2008

Password protect grub

By default with Ubuntu the user can use grub to login with root privileges WITHOUT a password, which I don't feel comfortable with. This is how I password protected grub to prevent changing the boot process:

> grub
grub> md5crypt

Password: YOUR_PASSWORD
Encrypted: abcdef

grub> quit


Now copy the encrypted string into the start of the grub file:

> sudo vim /boot/grub/menu.lst
password --md5 abcdef
lock

After saving change the permissions to prevent other uses viewing the file:
> sudo chmod 600 /boot/grub/menu.lst

Saturday, March 29, 2008

Recover password

If you forget your login password it can be recovered through grub. At boot enter the grub menu and choose 'single'. This will get you a root command prompt. Now run 'passwd' to set a new password. Now anyone can do this if they get access to your machine so you should password protect grub. I will write how to do this later.

Saturday, March 1, 2008

Email from the command line

echo "message" | mutt -s "subject" -x address@host.com