BASH Scripting Guide

Read On »

Null Route an IP

Adding a null route to a host on linux
This is done by adding the following line to the /etc/sysconfig/static-routes file:
any host 111.111.111.111 reject (being 111.111.111.111 the ip address to block)
When you perform a “route -n” you will see this IP with “-” as it’s gateway. This will cause your server to drop all response traffic to this IP.

Read On »

Some useful Commands.

Creating Linux install drive.
mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
cd /cdrom/images
dd if=boot.img of=/dev/fd0 bs=1440k
cut -d: -f1,7 /etc/passwd | grep sh | grep -v noshell
List: iptables -L -n | grep <IP Address>
Remove: iptables -D INPUT -s <IP 1> -d <IP 2> -j DROP
Insert: iptables -I INPUT -s <IP> -j DROP
Flush: iptables -F
Remove: iptables -D OUTPUT -s 0.0.0.0/0 -d 66.93.33.185 -j DROP
netstat -nap | grep :80 | wc -l //list number of connections connected to port 80
netstat -ntu | awk ‘{print $5}’ …

Read On »

Add Swap partition to Linux

You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but sometimes that is not easy if you do not have any free space available.

To add a swap partition (assuming /dev/hdb2 is the swap partition you want to add):

The hard drive can not be in use (partitions can not be mounted, and swap space can not be enabled). The easiest way to achieve this it …

Read On »

 Page 1 of 4  1  2  3  4 »