Showing posts with label Linux Scripts. Show all posts
Showing posts with label Linux Scripts. Show all posts

Friday, September 17, 2010

Protect GRUB with password

GRUB is very important since it is the first software program that runs when the computer starts
and we have to secure it as much as possible to avoid any possible problem. Below is a default GRUB configuration file and security I recommend you to apply. The text in bold are the parts of the configuration file that must be customized and adjusted to satisfy our needs.
Edit the grub.conf file (vi /boot/grub/grub.conf) and set your needs. Below is what we recommend you:
default=0
timeout=0

splashimage=(hd0,0)/grub/splash.xpm.gzpassword --md5 $1$oKr0ÝmFo$tPYwkkvQbtqo1erwHj5wb/
title Red Hat Linux (2.4.18-3)
root (hd0,0)
kernel /vmlinuz-2.4.18-3 ro root=/dev/sda5
initrd /initrd-2.4.18-3.img


password --md5 $1$bgGCL/$4yF3t0py.IjU0LU.q7YfB1

This option “password” is used to inform GRUB to ask for a password and disallows any
interactive control, until you press the key <p> and enter a correct password. The option --md5
tells GRUB that a password in MD5 format is required as a value. If it is omitted, GRUB assumes
the specified password is in clear text.
When we have installed the operating system, we have already configured GRUB with a
password protection. This password is what you see here. If you want to change it, you have to
use the “grub-md5-crypt” command to generate a new encrypt password it in MD5 format.
• This can be done with the following command:
[root@dev /]# grub-md5-crypt
Password:
$1$bgGCL/$4yF3t0py.IjU0LU.q7YfB184

Once the above command has been issued, you have to cut and paste the encrypted password
to your configuration file.

Wednesday, September 01, 2010

Recover Your Fedora Core

In case of dual OS, if u install windows (with pre-installed fedora), the boot loader will be lost and fedora become inaccessible. You can recover your Fedora by the following method:
Enter ur first CD of fedora core, reboot it.
Type linux rescue
Then on shell type chroot /mnt/sysimage
grub-install /dev/XXX (choose XXX=sda or hda or hdb as per ur system )
Reboot your Syatem
To know what is XXX type
# /sbin/fdisk -l
u'll see some lines with /dev/XXX , get what is XXX

Tuesday, August 31, 2010

Increase SWAP memory whenever You need it...

You want to increase your allocated swap memory and you don't want to do it permanently by Re-Partition or Re-Installation. Don't Worry!!! Your solution is here:


Insure that you have sufficient free disk space. Now suppose you need to increase SWAP by, say, 500Mb. Open ur terminal switch to admin. (use su followed by admin password) and use the following commands


# dd if=/dev/zero if=/home/tempswap bs=1k count=500000
# cd /home
# chmod 600 tmpswap
# mkswap tempswap
# swapon tempswap



Approximately 500 mb of swap will be added. For checking use free as:
# free -m
To release swap goto your tmpswap folder(it will be in
/home) #cd /home
#swapoff tmpswap
now delete tempswap
#rm -f tmpswap
recheck your swap now
#free-m

Monday, August 30, 2010

Change default boot option in multy-OS systems

Assuming that you have Grub boot loader (common in most of the Linux Distros.)
To change ur default boot option, do as follows:
Open terminal, then type the following codes(don't type $ or #, it will appear by itself)
$ su
enter ur admin password..
# cd /boot/grub 
(you will enter in to grub directory, there is a file named grub.conf. You have to edit it in some editor like Vim or Gedit, im going to use gedit. so type the following).
# gedit grub.conf 
gedit window will show u details something like below.

default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core details......
........................
..........................
title Windows details......
........................
..........................
You can see the first line having default as 0 means the first OS (see title) is default. If default is 1, second title. If default is 2 third tiltle would be the default OS to get booted.
So just choose default as 1 in ur windows is in second position.
save the current changes and reboot.