Wednesday, 9 December 2015

Error while uploading files to Cpanel accounts >> unknown bytes complete FAILED! :Upload canceled: VIRUS DETECTED! ( Access denied. ERROR )

If you are getting the following error while uploading files to the Cpanel accounts :

------------------------------------------------------
unknown bytes complete FAILED! :Upload
canceled: VIRUS DETECTED! ( Access denied. ERROR )
------------------------------------------------------

Go to WHM >> Manage Plugins.

There you can see the different add-ons. Check for clamavconnector.
If it is not installed, install it. If it is there, uninstall and install again.

Warning while restarting the CSF service >> *WARNING* Since the Virtuozzo VPS iptables ip_conntrack_ftp kernel module is currently broken

*WARNING* Since the Virtuozzo VPS iptables ip_conntrack_ftp kernel module is currently broken you have to open a PASV port hole in iptables for incoming FTP connections to work correctly. See the csf readme.txt under 'A note about FTP Conne ction Issues' on how to do this if you have not already done so.


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

It is important when using an SPI firewall to ensure FTP client applications
are configured to use Passive (PASV) mode connections to the server.

On servers running Monolithic kernels (e.g. VPS Virtuozzo/OpenVZ and custom
built kernels) ip_conntrack and ip_conntrack_ftp iptables kernel modules may
not be available or fully functional. If this happens, FTP passive mode (PASV)
won't work. In such circumstances you will have to open a hole in your firewall
and configure the FTP server to use that same hole.

For example, with pure-ftpd you could add the port range 30000:35000 to TCP_IN
and add the following line to /etc/pure-ftpd.conf and then restart pure-ftpd:
PassivePortRange        30000 35000

For example, with proftpd you could add the port range 30000:35000 to TCP_IN
and add the following line to /etc/proftpd.conf and then restart proftpd:
PassivePorts    30000 35000

FTP over SSL/TLS will usually fail when using an SPI firewall. This is because
of the way the FTP protocol established a connection between client and server.
iptables fails to establish a related connection when using FTP over SSL
because the FTP control connection is encrypted and so cannot track the
relationship between the connection and the allocation of an ephemeral port.

Increase Swap Size for linux Server

1. Create Swap file

 > touch /swapfile

2. To create 2GB of swap file,

 > dd if=/dev/zero of=/swapfile bs=1024 count=2048000

  For 4GB,

 > dd if=/dev/zero of=/swapfile bs=1M count=4096

3. mkswap /swapfile

Now the swap file is created.

4. To activate /swapfile file,

 > swapon /swapfile

5. Add entry on /etc/fstab file to activate after serevr reboot,

 > vi /etc/fstab

   /swapfile swap    swap    defaults        0 0

Now check the swap space,

 > free -m

Thursday, 29 October 2015

Increase Max user connection for a database

Max user connection for a database can be increased by following query



mysql > GRANT ALL ON dbname.* TO ‘dbuser’@’localhost’
->     WITH MAX_USER_CONNECTIONS 200;
Similarly max queries, max connections, max updates can be increased with below query
mysql > GRANT ALL ON dbname.* TO ‘dbuser’@’localhost’
->     WITH MAX_QUERIES_PER_HOUR 20
->          MAX_UPDATES_PER_HOUR 10
->          MAX_CONNECTIONS_PER_HOUR 5 ;

GRANT ALL ON dbname.* TO ‘dbuser’@’localhost’
->     WITH MAX_QUERIES_PER_HOUR 20
->          MAX_UPDATES_PER_HOUR 10
->          MAX_CONNECTIONS_PER_HOUR 5
->          MAX_USER_CONNECTIONS 200;

Tuesday, 15 September 2015

Server load alerts via email using shell script

>> cd /root

>> vi loadalert
=========================
EMAIL="your email"
SUBJECT="Alert $(hostname) load average is $L05"
TEMPFILE="/tmp/$(hostname)"
TOPLOAD="10"
echo "Load average Crossed allowed limit." >> $TEMPFILE
echo "Hostname: $(hostname)" >> $TEMPFILE
echo "Local Date & Time : $(date)" >> $TEMPFILE
echo "| Uptime status: |" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
/usr/bin/uptime >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "| Top 20 CPU consuming processes: |" >> $TEMPFILE
ps aux | head -1 >> $TEMPFILE
ps aux --no-headers | sort -rn +2 | head -20 >> $TEMPFILE
echo "| Top 10 memory-consuming processes: |" >> $TEMPFILE
ps aux --no-headers| sort -rn +3 | head >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "| Memory and Swap status: |" >> $TEMPFILE
/usr/bin/free -m >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "| Active network connection: |" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
/bin/netstat -tnup | grep ESTA >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
echo "| Disk Space information: |" >> $TEMPFILE
echo "-------------------------------------------" >> $TEMPFILE
/bin/df -h >> $TEMPFILE
echo "-----------------THE END-------------------" >> $TEMPFILE
L05="$(uptime|awk '{print $(NF-2)}'|cut -d. -f1)"
if test $L05 -gt $TOPLOAD
then
mail -s "$SUBJECT  $L05" "$EMAIL" < $TEMPFILE
fi
rm -f $TEMPFILE


chmod 755 loadalert
Updated this script on your cronjob
echo “*/5 * * * * /root/loadalert >/dev/null 2>&1″ >> /var/spool/cron/root
Restart cron service
/etc/init.d/crond restart

Sunday, 14 June 2015

Softaculous installation,backup and restoration on cpanel


Softaculous installation,backup and restoration on cpanel
============================
https://www.softaculous.com/docs/Installing_Softaculous_in_cPanel
https://www.softaculous.com/docs/How_to_Restore_a_Backup_on_a_New_Server

PHP 503 error >> Domain using word press

PHP 503 error >> Domain using word press
========================================
Error log
===========
2015-06-14 03:53:20.879 [INFO] [220.225.193.249:64615-0#APVH_wathletes.com] connection to [/tmp/lshttpd/APVH_wathlete_Suphp.sock.833] on request #0, confirmed, 1, associated process: 987667, running: 1, error: Connection reset by peer!
2015-06-14 03:53:20.879 [NOTICE] [220.225.193.249:64615-0#APVH_wathletes.com] Max retries has been reached, 503!
2015-06-14 03:53:20.879 [NOTICE] [220.225.193.249:64615-0#APVH_wathletes.com] oops! 503 Service Unavailable
2015-06-14 03:53:20.879 [NOTICE] [220.225.193.249:64615-0#APVH_wathletes.com] Content len: 0, Request line: 'GET / HTTP/1.1'
2015-06-14 03:53:20.879 [INFO] [220.225.193.249:64615-0#APVH_wathletes.com] abort request..., code: 4
2015-06-14 03:53:20.879 [INFO] [220.225.193.249:64615-0#APVH_wathletes.com] File not found [/home/wathlete/public_html/503.shtml]

=============
Resolution
==========

Check the Plugin folder and rename the plugin

=================