Friday, June 22, 2012

How to Find SETUID && SETGID Files.

Use below given script :--


find / -type f \( -perm -04000 -o -perm -02000 \) \-exec ls -lg {} \; 

Wednesday, February 8, 2012

Syn Attack

#SYN ATTACK :--
***********************************************
If under a SYN flood attack, it would look like this : --

tcp        0      0 12.34.56.78:80        211.48.6.244:1048         SYN_RECV      
tcp        0      0 12.34.56.78:80        128.223.93.135:1167     SYN_RECV      
tcp        0      0 12.34.56.78:80        194.15.197.170:1192     SYN_RECV      
tcp        0      0 12.34.56.78:80        199.155.53.109:1039     SYN_RECV      
tcp        0      0 12.34.56.78:80        4.168.188.28:1048         SYN_RECV  
    
when you run :  netstat -an |grep :80 |more 
but with several hundred of them, not five :)  
Assuming your kernel was built with syncookie support, type the following as root.
echo 1 > /proc/sys/net/ipv4/tcp_syncookies  
If it's not enabled, there isn't much you can do other than build a new kernel and reboot and use it or wait out the attack,
Some data centers can help with this as well....
----------------------------------------------------------------------------

Sunday, January 22, 2012

HardDisk Parameters (DMA/UDMA/CAPABILITIES)


 Commands are given below   :- 
----------------------
* To enable DMA for a hard drive: hdparm -d1 /dev/hda  


* To disable DMA for a hard drive: hdparm -d0 /dev/hda  

* To measure transfer rate of a hard drive: hdparm -Tt /dev/hda
  
* To see what options are enabled for a hard drive: hdparm /dev/hda  

* To see more info on your drive than you wanted to know: (this will show which UDMA modes are supported/enabled) hdparm -i /dev/hda 

Wednesday, January 18, 2012

Default locations for most commonly used configuration files and important directories:

**/  There are some important configuration files :--

..............***.................
#Exim 
/etc/exim.conf 
/var/log/exim_mainlog
/var/log/exim_rejectlog 
/etc/valiases/ 
/etc/vfilters/ 
/home/username/.forward
..............***................

#MySQL 
/root/.my.cnf 
/etc/my.cnf 
/var/lib/mysql/ 
...............***...............

#Apache 
/usr/local/apache/conf/httpd.conf 
/usr/local/apache/domlogs/ 
..............***................

#System 
/var/log/messages 
/var/log/dmesg 
..............***................

#Proftpd 
/etc/proftpd.conf 
/var/log/xferlog 
/etc/proftpd/ 
................***..............

#sshd 
/etc/ssh/sshd_config 
...............***...............

#PureFtp Config File
/etc/sysconfig/pure-ftpd
...............***...............

#Disable SMART Error in Cpanel
touch /var/cpanel/disablesmartcheck 
/scripts/updatenow

Wednesday, January 11, 2012

How to clear a full partition

-->tail -5000 filename > filename.new 

mv filename.new filename sync 

This will copy the last 5000 lines from the file to a temporary file. 

Now you probably want to restart whatever service it is that created the file to release it's file lock on the file.

 /usr also fills up sometimes because of apache.  The first thing you should look at is usually the apache logs. 

cd to /usr/local/apache 

and type "du -sh *" and chances are you'll find that the logs/error_log or logs/access_log is very large. 

Feel free to delete them or use the tail trick above.

-----****-----****------****------****------

Sunday, January 8, 2012

How to install a Perl Module


--: Steps are given below :--

--> On a server with CPanel, 
you can log into the WHM and install it there,  
If that for some reason doesn't work for you, you can log into the shell as root ,
and install it via the command line.  Once logged in, from any directory, 
type:   echo "HTML::Template" | /usr/local/cpanel/whostmgr/bin/perlmod -i  
(in this case, the module we want to install is HTML::Template).

Friday, January 6, 2012

Cpanel License File Expired


-------------------------------

service iptables stop

/usr/local/cpanel/cpkeyclt

service iptables start

------------------------------