Showing posts with label GRUB. Show all posts
Showing posts with label GRUB. Show all posts

Saturday, June 11, 2011

Disabling USB port on CentOS 5

To disable USB port on the machine, you can edit the grub.conf
# vim /boot/grub/grub.conf

Add the kernel parameter
kernel /vlinuz ..... rhgb quiet nousb

Reboot your system and you will notice all your usb ports disabled

Sunday, June 20, 2010

Protecting GRUB Boot loader for CentOS

Much of the material is taken from "How Do I Secure Grub Boot Loader?" taken from http://www.cyberciti.biz/ and the book "Foundation of CentOS Linux" from aspress

Without the GRUB Password, anyone can edit the kernel parameters and boot into single-user mode and  enable them to log as root.

Step 1:
Use grub-md5-crypt command encrypt password in MD5 format:
# grub-md5-crypt

Password:
Retype password:
$1$gBrNd/$QccThGN4QFPdOiOtaTl.c0



Step 2: Edit GRUB configuration file
# vi /boot/grub/menu.lst

Insert this line into /boot/grub/menu.lst
password --md5 $1$gBrNd/$QccThGN4QFPdOiOtaTl.c0

Something like this....
# grub.conf generated by anaconda
#........
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
password --md5 $1$H7tNd/$GEYVMUDHmIkhb4xwNwywR.
title CentOS (2.6.18-164.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-164.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet
initrd /initrd-2.6.18-164.el5.img

It's done. Horray

Saturday, June 19, 2010

Boot Time Parameters for Linux Kernel on CentOS 5

In CentOS, the default boot lader is GRUB (Grand Unified Boot loader). GRUB allows users to choose which operating system you would like to boost. In addition, GRUB can be used to inform or pass parameters to the kernel

How to modify GRUB

Step 1:
When GRUB start, press any keys and it will show you a boot menu.

Step 2:
In the menu, you can select the kernel to boot and press "e"

Step 3: You will see something like this on the screen
grub append > ro root=LABEL=/ rhgb quiet

Step 4a: Put in the necessary parameters. For example, if I wish to boot to "single"
grub append > ro root=LABEL=/ single

Step 4b: If I wish to boot into console with network support, use the parameter: init=/sbin/init 3
grub append > ro root=LABEL=/ init=/sbin/init 3

Step 4c: If I wish to specify the memory, use the parameters: mem=MEMORY_SIZE
grub append > ro root=LABEL=/ mem=1024M

Step 4d: If you wish to reboot the kernel after the kernel panic, you can set the parameter panic=SECOND
grub append > ro root=LABEL=/ panic=30

For more parameters, do read the excellent article on
  1. 10 boot time parameters you should know about the Linux kernel
  2. Booting to Single Mode for Centos LINUX