The mod_security plugin could not connect to the database: cPanel

If you have been getting the error “The mod_security plugin could not connect to the  database”

Below are the steps to rectify it

SSH to server

Check the password set for modsec database using below command,

In my case below was the password

root@vps [~]# grep “dbpassword” /etc/cron.hourly/modsecparse.pl

my $dbpassword = ‘qS_lqkU5mXkA’;
my $dbh  = DBI->connect( “DBI:mysql:$dbname:$dbhost”, $dbuser, $dbpassword )

The password set in my case as  qS_lqkU5mXkA

Now login into mysql and use below steps

root@vps [~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1569
Server version: 5.5.36-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD(‘qS_lqkU5mXkA’) WHERE USER=’modsec’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit

Login to WHM >> Plugin > Mod_security

You should be able to see working Mod_security

Connection To Storage Server Failed (Roundcube login issue, installed from cpanel)

Edit:  /home/mydomain/pathtoroundcube/config/main.inc.php and changed
$rcmail_config[‘default_host’] = ‘ssl://imap.site.com’;
to
$rcmail_config[‘default_host’] = ‘mail.mydomain.com‘;

Change the default character set in Apache

By default apache  sets the default character set in Apache to UTF-8.

You can set it using .htaccess  using below rule for arabic

AddDefaultCharset ISO-8859-1

Thats would make web browser show arabic character

 

 

How to find the max inode using folder in server in linux ?

Inodes are the important feature on any server which can sometimes be overused by clients in shared hostingTo find the user or folder using max inodes ,

SSH to server as root

#cd /home     ; Change directory to /home

run below command to see the max using inode account

This will show the max inode folder and then can login to the folder and run below command to see the exact folder which is using max inode

for d in *; do echo -n “$d: “; find $d -type f | wc -l; done

Find Brand of Hard disk in Linux server

Want to fine the find the band name or serial number of the hard disk in Linux sever ?           You just need one package called  hdparm which can be installed using below command

#yum -y install hdparm                                                                                                                  To check hard disk specification run below command

# hdparm -I /dev/sda

Below is the result shown
/dev/sda:

ATA device, with non-removable media
Model Number:       ST1000DM003-9YN162
Serial Number:      S1D55TYB
Firmware Revision:  CC4H
Transport:          Serial, SATA Rev 3.0

Fine spammer account in cpanel server

Getting sick of spammers in server and IP blacklisting ?  To find the spammer account in server you need to SSH to server and run below command

awk ‘$3 ~ /^cwd/{print $3}’ /var/log/exim_mainlog | sort | uniq -c | sed “s|^ *||g” | sort -nr

This will show the the path of the user account from where max email was sent  in sorted order.

You can suspended the user and also check if any malicious file in the directory shown.

 

 

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression

Getting this error on Firefox 3.x browser ? Below is the solution for this issue which does fix this issue

Clearing cache and cookies solves the problem! (Tools -> Clear Private Data; it is enough to select only cache and cookies)

 

 

recreate /etc/userdomains in cPanel server

Deleted or corrupted  file in cpanel server for /etc/userdomains ?  Use below 2 commands to by logging in as root to  restore the file

# /usr/local/cpanel/bin/userdata_update

and then run

#/scripts/updateuserdomains

 

 

File Manager Permission in cPanel

Having issues with cpanel Filemanager where you can write on a file with 444 permissions ? The issue is with X3 theme
. You need to modify below line in file

vi  /usr/local/cpanel/base/frontend/x/files/changeperm.html

And see if you see the line:
cpanelFileman=

change it to  without space
cpanelFileman=

 

 

 

Error from Park wrapper: Sorry, you do not control the domain

Are you getting below error ??

Unable to remove add-on domain from cPanel – Error from Park wrapper: Sorry, you do not control the domain

Remove the entries for the domain from the following files.
====================
/var/cpanel/users/username                                                                                        Run Script — /scripts/updateuserdomains
/scripts/killdns  domain.db
/usr/local/apache/conf/httpd.conf
/etc/localdomains
/etc/userdomains
/etc/trueuserdomains
/etc/trueuserowners
/etc/valiases/domain.com
/etc/vdomainaliases/domain.com
/etc/vfilters/domain.com
 /var/cpanel/userdata/username – Remove the parked domain folders                                               /var/cpanel/userdate/username/main