Restoring GRUB after a reinstall

By abhishek

You had just did a weekly install of some OS which did not detected Linux, Follow the steps mentioned below to get GRUB working again. Please note this would erase the current bootloader and install a new one for you if you are unsure of what you are doing do not try this

  1. Boot from a Linux Live CD ( ex ubuntu or knopix, i use Ubuntu)
  2. Open the terminal
  3. Follow the commands mentioned below
  • sudo grub

if sudo doesnot works switch to root user and use grub drectly, Find the ROOT device you will get the values for X & Y which will be used later.

  • grub> find /boot/grub/stage1

Set the root device from the information achieved from the above command

  • grub> root (hdX,Y)

Install GRUB

  • grub> setup (hd0)

Exit GRUB

  • grub> quit

Reboot the system without using the live CD you will dind your boot loader back :)

From http://ubuntuforums.org/showpost.php?p=121355&postcount=5

User / Group Disk Quotas A three Step Guide

By abhishek

A disk quota is a limit set by a system administrator that restricts certain aspects of file system usage on modern operating systems. "Wikipedia"

Requirements : Quota Package

Where to get it : Quota package is generally available in majority of Linux Distros but still if your distro doesn't provide you with Quota compile it from http://sourceforge.net/projects/linuxquota/ :)

Step 1) Installation :

a) openSUSE : yast -i quota

b) Ubuntu : sudo apt-get install quota

c) Fedora : yum install quota

d) Others : Use rpm or compile if not available

 

Step 2) Enable Disk Quota

Disk quota is generally applied on a user or a set of users to its recommended to enable Disk Quota on your Home partition dont enable quota on the root partition unless you are under the expert category

To enable disk quota in certain partition just add "usrquota,grpquota" to that partition in your fstab you need root privileges to do this of course.

Following is my sample fstab entry for /home

/dev/sda9 /home ext3 acl,user_xattr,usrquota,grpquota 1 2

After you have added the entry in fstab you need to create the aquota.user and aquota.group files in the partition where you have enabled quota /home in our case use the following command in /home directory

touch aquota.user

touch aquota.group

chmod 600 aquota.user

chmod 600 aquota.group

Now a reboot is recommended

 

Step 3) Limiting Users on Quota

Now its the time to give quota to user/groups using the following command

edquota -u <username>

or

edquota -g<groupname>

This will open up the configuration file which would look something like this

Disk quotas for user <user> (uid <uid>)

Filesystem blocks soft hard inodes soft hard

/dev/sda9 9215 1048576 1050624 603 0 0

You would notice soft, hard and inodes in this file i would recommend not to use inode as using this would be limiting user on the number of files to create specify size in KB for soft and hard part soft is actually the limit and after soft limit is reached the user is given a grace on size to a maximum mentioned as hard

This completes quota :)

Now how to apply same settings for different users, For instance, to use the same settings for user "nagar" that you set for user "abhishek", you would enter:

edquota -p abhishek -u nagar

 

Further Study http://www.centos.org/docs/5/html/Deployment_Guide-en-US/ch-disk-quotas.html

SMTP Authentication Support for your Drupal Sites

By abhishek

Drupal uses the php mail() function to send emails by default.
 
Here is a module which adds SMTP functionality to Drupal. More specifically, the ability for your site to send mail using an SMTP server that requires authentication.
 
Link to Module http://drupal.org/project/smtp
This module is currently in Beta stage for Drupal 6.x, i just tried it works fine and you can use this too. remember to read INSTALL.txt before installing this module as there are certain dependencies which are needed to have this module working.
 
This module uses the smtp and mail class’s from PHPMailer. http://phpmailer.sourceforge.net

How to Masquerade (ICS) in Linux

By abhishek

Its very simple to masquerade in linux with few lines of iptables and ip_forward commands.

Assumptions : Your Linux box has 2 NIC's one connected to internet (eth0) other connected to local network (eth1 IP 192.168.0.10)

first of all you have to flush and delete existing firewall rules which are there by default in linux .

so flush rules by typing the following in terminal

iptables -F
iptables -t nat -F
iptables -t mangle -F

now delete the chains by using

iptables -X
iptables -t nat -X
iptables -t mangle -X

now its time to save iptables so type

service iptables save
service iptables restart

now all rules and chains will clear !

check it by /etc/sysconfig/iptables which has all defaults rules set to accept.

now open /etc/rc.d/rc.local

and insert the following line

echo ” 1 “> /proc/sys/net/ipv4/ip_forward

and then save and close.

now asuming that your internet interface is eth0 then type :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
service iptables save
service iptables restart

note:- check your service of iptables is set to start during boot up .

or check status of your iptables service

chkconfig -–list iptables

if level 5 is on then its ok othewise start service at level 5 or level 2345.

Now Set the Default Gateway of eth1 as eth0's IP Address

and then set Default Gateways of all other client to Server's eth1's IP address (192.168.0.10) enjoy :)

Adding CAPTCHA to Drupal Guestbook Module

By abhishek

Guest book is one of the essential part for any website, To add a guestbook on your drupal site you can use the guestbook module, the problem you would face is adding a captcha to this now captcha is also very essential to control spam now how to add captcha its very simple just execute the following query

 

INSERT INTO `captcha_points` ( `form_id` , `module` , `type` ) 
VALUES
( 'guestbook_form_entry_form', NULL , NULL );

and you are done now go to /admin/user/captcha on your site and enable captcha on guestbook this would look something like this