Oct 302009
 

Adding a logrotate script to clean up apache will normally take care of this problem. The default logrotate script is either /etc/logrotate.d/apache or /etc/logrotate.d/httpd.

vim /etc/logrotate.d/httpd or apache

insert the code below:

/usr/local/apache/logs/*log /usr/local/apache/domlogs/*.com /usr/local/apache/domlogs/*.net /usr/local/apache/domlogs/*.org /usr/local/apache/domlogs/*.edu /usr/local/apache/domlogs/*.it /usr/local/apache/domlogs/*.dk /usr/local/apache/domlogs/*.de /usr/local/apache/domlogs/*.nz /usr/local/apache/domlogs/*.si /usr/local/apache/domlogs/*.in /usr/local/apache/domlogs/*.ie /usr/local/apache/domlogs/*.fr /usr/local/apache/domlogs/*.es /usr/local/apache/domlogs/*.br /usr/local/apache/domlogs/*.ar /usr/local/apache/domlogs/*.jp /usr/local/apache/domlogs/*.uk /usr/local/apache/domlogs/*.ru /usr/local/apache/domlogs/*.at /usr/local/apache/domlogs/*.nl /usr/local/apache/domlogs/*.us /usr/local/apache/domlogs/*.gov /usr/local/apache/domlogs/*.au /usr/local/apache/domlogs/*.tr /usr/local/apache/domlogs/*.tt /usr/local/apache/domlogs/*.no /usr/local/apache/domlogs/*.ro /usr/local/apache/domlogs/*.cn /usr/local/apache/domlogs/*.ca /usr/local/apache/domlogs/*.cz /usr/local/apache/domlogs/*.sp /usr/local/apache/domlogs/*.pl /usr/local/apache/domlogs/*.sa /usr/local/apache/domlogs/*.gr /usr/local/apache/domlogs/*.il /usr/local/apache/domlogs/*.ph /usr/local/apache/domlogs/*.info /usr/local/apache/domlogs/*.pr /usr/local/apache/domlogs/*.sy /usr/local/apache/domlogs/*.ua {
compress
weekly
notifempty
missingok
rotate 3
sharedscripts
postrotate
/bin/kill -HUP `cat /usr/local/apache/logs/httpd.pid 2>/dev/null` 2> /dev/null || true
endscript
}

This should catch most of the domloas on the system and rotate them out with the following command;

logrotate -fv /etc/logrotate.d/httpd or apache

 Posted by at 10:21 am
Oct 302009
 

How to Disable ping to server?

To disable ping

echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
To enable ping
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all

 Posted by at 10:16 am
Oct 302009
 

How to Kill Zombie Process in server??

This command will be useful to kill php zombie process.

ps -ef | grep mailnull | grep -v grep | awk ‘{print “kill -9″, $2}’ | sh

replace mailnull with particular proces name which has zombie

 Posted by at 10:16 am
Oct 302009
 

you can modify the command with the most used attacking words like wget, etc
find /usr/local/apache/domlogs/ -exec egrep -H ‘(wget|curl|lynx|wget)%20? {} \;

tail -100000 /usr/local/apache/logs/access_log | awk ‘{print $1}’ | sort | uniq -c |sort -n
netstat -tn 2>/dev/null | grep :80 | awk ‘{print $5}’ | cut -f1 -d: | sort | uniq -c | sort -rn | head
netstat -anp | grep 80
tac /usr/local/apache/logs/error_log |less
netstat -tn 2>/dev/null | grep :80

/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | awk ‘BEGIN { FS = ” ” } ; { print $12 }’ | sed ‘/^$/d’ | sort | uniq -c
site connections
/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk ‘{print $12}’ | sort | uniq -c | sort -rn | head
busiest site
/usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk ‘{print $14}’ | sort | uniq -c | sort -rn | head
busiest script

rlog /usr/local/apache/conf/httpd.conf | head -35
changes made to httpd.conf

/usr/local/apache/bin/httpd -S
gives a listing of how the active vhosts are configured and in what order they are loaded, including IP addresses, domain names, port and other infos

netstat -tn | grep :80 | wc -l
open connections to your webserver

netstat -an |grep :80 |wc -l
Show how many active connections there are to apache (httpd runs on port 80)

 Posted by at 10:14 am
Oct 302009
 

How To Enable Root (Super) User in Ubuntu

If you are new to Ubuntu and have been using other distros like Fedora or openSUSE before, then you may find it frustrating that when you issue the “su” command it will result to authentication failure.

By default, access to root account password is disabled in Ubuntu for added security measures. But if you really want to enable root (super) user in Ubuntu just like you can on other Linux distributions, you can do it in two ways.

One way it to set a root user password by:

$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

After this, you will now be able to successfully use the “su” command:

$ su -
Password:
#

You can always disable the root user password through this command:

$ sudo passwd -l root

The second and probably the simplest method of enabling root user in Ubuntu is by executing either of the following:

$ sudo -s

or

$ sudo su -

That’s about it. I hope some of you out there will find this simple tip on how to enable the root (super) user in Ubuntu useful.

 Posted by at 9:54 am