Fail2ban – Prevent Postfix Brute Force


# apt-get install fail2ban

To limit memory usage, add to /etc/default/fail2ban:

+ulimit -s 256

Local config file
Create a local config file /etc/fail2ban/jail.local to override settings in jail.conf:

To ban authentication via SSH after 3 failed attempts add the following to /etc/fail2ban/jail.local:

enabled   = true
port      = ssh
filter    = sshd
logpath   = /var/log/auth.log
maxretry  = 3


# /etc/init.d/fail2ban restart

Postfix and Dovecot
To ban authentication to Postfix and Dovecot after 3 failed attempts add the following to /etc/fail2ban/jail.local:

enabled = true
port = pop3,pop3s,imap,imaps
filter = dovecot
logpath = /var/log/mail.log
maxretry  = 3

enabled  = true
port     = smtp,ssmtp
filter   = postfix
logpath  = /var/log/mail.log
maxretry  = 3

enabled   = true
port      = smtp,ssmtp,imap2,imap3,imaps,pop3,pop3s
filter    = sasl
logpath   = /var/log/mail.log
maxretry  = 3

Fail2ban (Debian Squeeze) isn’t shipped with a configuration for Dovecot, so create /etc/fail2ban/filter.d/dovecot.conf:

failregex = (?: pop3-login|imap-login): .*(?:Authentication failure|Aborted login \(auth failed|Aborted login \(tried to use disabled|Disconnected \(auth failed).*rip=(?P\S*),.*
ignoreregex =

Restart fail2ban:

# /etc/init.d/fail2ban restart

To ban IPs after 3 failed login attempts add the following to /etc/fail2ban/jail.local:

enabled = true
port    = http,https
filter  = apache-auth
logpath = /var/log/apache*/*error.log
maxretry = 3

Copy Large amount of data using rsync

Copying large amount of data,like 300 or 400GB’s from one hdd to another using nautilus or any file manager may fail on some occasions. Using the command rsync will be a better idea to copy large piles of data. This will show the progress percentage and the amount of data copied.

rsync -ah --info=progress2 SOURCE_PATH DESTINATION_PATH

change SOURCE and DESTINATION path according to your needs.

Debian Kernels and Tigon TG3 Firmware

If you are updating the kernel on your Debian 5.0 (Lenny) or Debian 6.0 (Squeeze) installation and have a Tigon Gigabit ethernet controller, such as the one on the Dell Poweredge T110, you may receive the following warning messages:

W: Possible missing firmware /lib/firmware/tigon/tg3_tso5.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3_tso.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3.bin for module tg3

How to fix this problem

1.) Add the “non-free” repository to the sources.lst file.

vim /etc/apt/sources.list
deb squeeze main contrib non-free
deb-src squeeze main contrib non-free

2.) Update apt-get and install the “firmware-linux-nonfree” package.

apt-get update
apt-get install firmware-linux-nonfree

How to configure RAID in Debian Squeeze

Purpose of RAID

Improve read/write performance and ensure redundancy in case of a hard disk failure.

RAID levels

Raid levels can be known in detail from wikipedia


cat /proc/mdstat

If there are any RAID devices present, they will be shown in the terminal…like this

md2 : active raid1 sda4[0] sdb4[1]

md1 is a RAID 1 (mirror) device, spanning sda4 and sdb4 partitions. This device is active and mounted. If it were not used, it would have been listed under unused devices further below.

458111864 blocks super 1.2 [2/2] [UU]

[2/2] [UU ]  – tells us both partitions are used.

if  it appears like this  [1/2]  or [U_] then you have a degraded RAID array.

Do manual partition and make partitions as per you need

edit partitions and select use as physical volume for raid

repeat this for all partitions and make all partitions physical volume for raid

Then select Configure Software Raid

Then select write changes to disk if correct

the next step is to create a new MD device.Choose Create MD device


Then choose the raid type you want

Choose no of devices

need to decide how many (active) devices will participate in the its two

The next step is to choose spares here its zero

Next choose devices we need to select which devices we want to use. For the first device, we’ll use sda1 and sdb1.

repeat the procedure for the other two devices

Now select root ,swap and home partitions….

Then installation begins………….

After  installation boot up to your system open terminal and type

cat  /proc/mdstat

Set / Change / Reset the MySQL root password on Ubuntu/Debian Linux

Stop the MySQL Server

sudo /etc/init.d/mysql stop

Start the mysqld configuration.

sudo mysqld --skip-grant-tables &

Login to MySQL as root

mysql -u root mysql

Replace YOURNEWPASSWORD with your new password!


This worked for me at the last step changedthe user with root and gave the password

Installing Node.js and NPM on Ubuntu/Debian

This is the simple way to install Node.js and npm which is needed for the installation of coco2d javascript

Step 1 – Update your system

sudo apt-get update
sudo apt-get install git-core curl build-essential openssl libssl-dev

Step 2 – Install Node.js

First, clone the Node.js repository:

git clone
cd node

Now, if you require a specific version of Node:

git tag # Gives you a list of released versions
git checkout v0.4.12

Then compile and install Node like this:

sudo make install

Then, check if node was installed correctly:

node -v

Step 3 – Install NPM

Simply run the NPM install script:

curl | sudo sh

And then check it works:

npm -v
 Happy Hacking

Directory size excluding sub-directories – Linux

To find the size of a directory which has several sub directories can be done by using the following command

du  -skh  /home/user

please note the “s” here used is lower case  if we use upper case then it will list size of all sub directories too….replace the /home/user with your folder name..

you can also use this command  to find total space used

du -ch | grep total