Archives

All posts for the month May, 2011

Disable Directory Browsing in Linux Apache Server

Published May 14, 2011 by Siva

Disable directory browsing using .htaccess:-
Open your .htacces file

Look for Options Indexes
If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
The directory browsing feature should be disable by now

Disable directory browsing using httpd.conf:-

Open your httpd.conf, normally it’s located at /usr/local/apache/conf or /etc/httpd.conf
Go to your own Virtual Host settings and look for “Options Indexes”
Change the Indexes to -Indexes if Option Indexes exists or else add the Options -Indexes line
Restart your apache web server.

The directory browsing feature should be disable by now

Disable directory browsing in CPanel Share Hosting enviroment:-

Login to your CPanel
Click on Index Manager
Directory will be list down. Click on the directory name which you want to disable the directory browsing
Select No Index and click Save

The directory browsing feature should be disable by now
Once you disable directory browsing, visitor will not able to browse your directory by accessing the directory directly (if there is no index.html file).
This will protect your files from exposing to the public.

Re-install bootstrap code (GRUB)

Published May 14, 2011 by Siva

Please perform the following steps:

Boot from CentOS installation disc (for example, CD #1 or DVD).
Type “linux rescue” at the “boot:” prompt.

Mount all filesystems in read-write mode.
Change root to real root (‘/’) on your hard disk:

# chroot /mnt/sysimage

Re-install bootstrap code (GRUB).
If you wish to re-install GRUB to the MBR on a SCSI or SATA disk (/dev/sda):
# grub-install /dev/sda

If you wish to re-install GRUB to the PBR of Partition #2 on a SCSI or SATA disk (/dev/sda2):
# grub-install /dev/sda2

If you wish to re-install GRUB to the MBR on an IDE disk (/dev/hda):
# grub-install /dev/hda

If you wish to re-install GRUB to the MBR on a HP Smart Array disk (/dev/c0d0):
# grub-install /dev/cciss/c0d0

Alternative Recovery from GRUB Issues – Super Grub Disk
Super Grub Disk has a variety of open source boot recovery tools. For CentOS legacy GRUB SuperGRUB works well.