Archive for the ‘Admin’ Category

Unban IP from fail2ban

December 28, 2015

First find the name of the jail using

fail2ban-client status 

Then remove the IP by entering

fail2ban-client set Jail-name unbanip


fail2ban-client set ssh unbanip


Finding php configuration string from php binary installed.

March 25, 2008

Enter the command:
strings `which php` | grep ./configure | sed s#”‘”#””#g

To check how fast a domain loads

December 3, 2007

and to convice the user 😉

time wget -q <domainname>

Thank you Sari for the tip 🙂

Script to check if Googlebot IP is blocked on apf

November 24, 2007



#Give the email address(es) to which the script will have to send the alerts

cat $MAIL_BODY|mail -s ” Googlebot IP blocked on $hostname” $MAIL_TO
rm -f $MAIL_BODY

for i in `cat /etc/apf/deny_hosts.rules | grep -v “#” `
host $i | grep googlebot
if [ $? -eq 0 ]
echo $i >> $MAIL_BODY

if [ -f $MAIL_BODY ]
echo “Check the reverse DNS as well before unblocking this IP” >> $MAIL_BODY

Mounting proc filesystem: Bad file descriptor

November 5, 2007

Ballu called me as he got this error:

Mounting proc filesystem Bad file descriptor
No such partition found …

Something modifed /dev/null to a regular file. To fix, login into repair mode, remount root filesystem as read-write, and restore /dev/null:

# mount -n -o remount,rw /
# rm -f /dev/null
# mknod -m 0666 /dev/null c 1 3

It worked.

Protected: Mongrel-:m:O:.n.

November 5, 2007

This content is password protected. To view it please enter your password below:

Protected: C-trace

November 5, 2007

This content is password protected. To view it please enter your password below:

Different output for df -h and du for /tmp

October 31, 2007

There were some process running which were referring to the files in tmp, even though the files are deleted and that was causing the difference in output for df -h and du for /tmp

To kill those processes:

for i in `lsof | grep deleted | grep tmp |awk {'print $2'}`; do kill -9 $i; done

Attaching text file in mail from shell

September 25, 2007

(echo “$afilename is attached” ; cat $afilename | uuencode $afilename) | mail -s “`echo $afilename`”

Redirecting traffic coming to port 26 to port 25

September 25, 2007

# redirect traffic coming in on port 26 to port 25
/sbin/iptables -t nat -I PREROUTING -p tcp –dport 26 -j REDIRECT –to-port 25
# make it so that this command runs on server boot up.
if ! grep -qai 26 /etc/rc.local; then
echo ‘/sbin/iptables -t nat -I PREROUTING -p tcp –dport 26 -j REDIRECT –to-port 25’ >> /etc/rc.local