Clear eximstats mail database in cpanel/WHM


First check the disk space on eximstats directory

root@server [~]# du -sh /var/lib/mysql/eximstats

To clear the database entries , login to mysql

root@server [~]# mysql

Once logged in just fire the below commands :-

mysql> use eximstats
mysql> delete from sends;
mysql> delete from smtp;
mysql> delete from failures;
mysql> delete from defers;

Thats it.

 

Mysql error :- ERROR! MySQL is not running, but lock exists root@server


Mysql is not running on the server. when I try to connect to mysql I get the following error :-

 

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

root@server [~]# mysql
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
root@server [~]# /etc/init.d/mysql status
ERROR! MySQL is not running, but lock exists
root@server [~]#

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

When checked with the mysql service I got this error

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

root@server [~]# /etc/init.d/mysql status

ERROR! MySQL is not running, but lock exists
root@server [~]#

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

 

Here are the steps that should fix the issue.

root@server [~]# rm /var/lock/subsys/mysql
rm: remove regular empty file `/var/lock/subsys/mysql’? y

root@server [~]# /etc/init.d/mysql start

If still it doesnt  solve the issue, The best possibility is that the mysql PID file was left after the system restart and I assume that mysql server was not stopped properly.

So please check mysql by following command

root@server [~]# top |grep mysql

OR

root@server [~]# ps aufx | grep mysql

If it shows the mysql process, Kill that mysql process and again run the command :-

root@server [~]# rm /var/lock/subsys/mysql

and start the mysql service by

root@server [~]# /etc/init.d/mysql start

This should resolve the issue

 

 

 

FTP stops at MLSD


Just has an issue with the client that whenever he connects his domain via FTP through Filezilla , it connects but it stops at MLSD.

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

Status:   Resolving address of ftp.hi2.ro
Status:   Connecting to 89.42.38.160:21…
Status:   Connection established, waiting for welcome message…
Response:   220 ProFTPD 1.3.2 Server (fast FTP) [89.42.38.160]
Command:   USER andreeib
Response:   331 Password required for andreeib
Command:   PASS ***************
Response:   230 User andreeib logged in
Command:   SYST
Response:   215 UNIX Type: L8
Command:   FEAT
Response:   211-Features:
Response:    MDTM
Response:    MFMT
Response:    MFF modify;UNIX.group;UNIX.mode;
Response:    MLST modify*;perm*;size*;type*;unique*;UNIX.group*;UNIX.mode*;UNIX.owner*;
Response:    REST STREAM
Response:    SIZE
Response:   211 End
Status:   Connected
Status:   Retrieving directory listing…
Command:   PWD
Response:   257 “/” is the current directory
Command:   TYPE I
Response:   200 Type set to I
Command:   PASV
Response:   227 Entering Passive Mode (89,42,38,160,234,169).
Command:   MLSD

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

So This is how it was fixed :-

==> Login to the server using SSH as root user

==> Open the file /etc/csf/csf.conf

==>Search for TCP_IN and TCP_OUT and see if port 30000:35000 is added, If not Do add the port as 30000:35000

TCP_IN = “20,21,22,25,26,53,443,30000:35000”
TCP_OUT = “20,21,22,25,26,53,443,30000:35000”

==> Exit and save

Now Edit the pure-ftpd.conf file

==> Open the file /etc/pure-ftpd.conf

==> Scroll down and look for the line that says “PassivePortRange 30000 35000″

==> Make sure it is not commented out (with a # at the front)
Save the file

==>Restart the FTP server

Thats It.. The FTP then worked for me.

How to Assign single/One IP to multiple domains/Accounts in Cpanel


Assign single/One IP to multiple domains/Accounts  in Cpanel :-

Lets say you have domain1.com, domain2.com, and domain3.com on the same server and you want to keep them as individual accounts while allowing them to share an IP address. This works much is shared hosting

1.) Login to the WHM and click Show IP Address Usage

2.) Find an available IP address that you would like to use and Copy it in a Notepad

3.) Click on Basic cPanel/WHM Setup – Search for The IP address (only one address) that will be used for setting up shared IP virtual hosts.
Setting an IP not associated with this server is possible but not advised. – This should be your primary server IP (Write down this IP for future reference). Update this with the newly copied IP address that you’d like to use and click Save Changes
– Note this does not change any sites to this IP

4.) Click Change Multiple Sites’ IP Addresses
Locate and check the domains that should share this new IP i.e. domain1.com, domain2.com, domain3.com

5.) Click Change IPs of Selected Accounts


6.) Next to each site there should be a drop down box. Select the last option in each drop down box which should read:
0.0.0.0 (main shared IP) where 0.0.0.0 is the new IP for the sites to share
7.) Click Change IPs

You now have a group of accounts sharing the same IP in cpanel!

Important Note– Once you are done Click on Basic cPanel/WHM Setup – Main Shared Virtual Host IP – replace this value with the original Main Shared Virtual Host IP and click Save Changes. If you don’t newly created accounts will receive the IP address that you just setup for a specific group

Installing Postgres (PostgreSQL) in Cpanel Server


PostgreSQL is a free object-relational database server.It offers an alternative to other open-source database systems such as MySQL

Installing Postgres database on Cpanel server is very easy. Just run following command on SSH prompt as root.

root@server1 [~]#  /scripts/installpostgres

The script will fetch Postgres database and required other programs and install.

root@server1 [~]# /scripts/installpostgres
This script will install Postgres 7.3.x or later
If you have an older version installed you wil need to
Dump your databases to a file and then restore them
after the install as 7.3.x is not backwards compatible.
If you do not have any databases, you can just run:
mv /var/lib/pgsql /var/lib/pgsql.old
/sbin/service postgresql stop
/sbin/service postgresql start
to force creating a 7.3.x style setup. Do not do this if
you have databases that you wish to keep!

Are you sure you wish to proceed? y
Repository base is listed more than once in the configuration
.
.
.
.
Initializing database: [ OK ]
Starting postgresql service: [ OK ]
You should now configure postgresql from WHM!
root@server1 [~]#

Following packages are installed on CentOS server

root@server [~]# rpm -qa | grep postgre
postgresql-libs-8.1.23-1.el5_7.3
postgresql-8.1.23-1.el5_7.3
postgresql-devel-8.1.23-1.el5_7.3
postgresql-server-8.1.23-1.el5_7.3

Now login to your WHM, click on Postgres Config under SQL Services. Set a new password for Postgres. You should avoid using any non-alpha numeric charaters as these cause problems.

Go back to the Postgres Config and click on the option to install a postgres pg_hba.conf file.

postgre sql installation on cpanel

 

You can check  the version of postgresql  by following command :-

root@s709 [~]# postgres –version
postgres (PostgreSQL) 8.1.23

Now Postgres SQL is installed on your server, you will be able to see it in Cpanel.

 


 

 

 

How to check if the server is 32 or 64 bit in Linux and Windows ?


IN LINUX :-

[root@server]# uname -a 

Linux root.server.com 2.6.32-042stab044.11 #1 SMP Wed Dec 14 16:02:00 MSK 2011 x86_64 x86_64 x86_64 GNU/Linux

[root@server]# uname -i

x86_64

[root@server]# arch

x86_64

[root@server]# getconf LONG_BIT

64

IN WINDOWS :-

Windows Vista

Method 1
Click Start, then click on Run or Start Search.
Type msinfo32.exe and then press Enter key.
In “System Information”, review the value for the System Type item:
For 32-bit editions of Windows, the value of the System Type item is x86-based PC.
For 64-bit editions of Windows, the value of the System Type item is x64-based PC.

Method 2
Click Start, type system in the “Start Search” box, and then click system in the “Programs” list.
The operating system appears as follows:
For a 64-bit version operating system: 64-bit Operating System appears for the “System type” under “System”.
For a 32-bit version operating system: 32-bit Operating System appears for the “System type” under “System”.
Method 3
Click Start, type system in the “Start Search” box, and then click System Information in the “Programs” list.
The operating system appears as follows:
For a 64-bit version operating system: x64-based PC appears for the “System type” under “Item”.
For a 32-bit version operating system: x86-based PC appears for the “System type” under “Item”.

Microsoft Windows XP Professional

Method 1
Click Start, then click on Run or Start Search.
Type msinfo32.exe and then press Enter key.
In “System Information”, review the value for the System Type item:
For 32-bit editions of Windows, the value of the System Type item is x86-based PC.
For 64-bit editions of Windows, the value of the System Type item is x64-based PC.

Method 2
Click Start, click Run, type sysdm.cpl, and then click OK.
Click the General tab. The operating system appears as follows:
For a 64-bit version operating system: Microsoft Windows XP Professional x64 Edition Version <Year> appears under System.
For a 32-bit version operating system: Microsoft Windows XP Professional Version <Year> appears under System.
Note <Year> is a placeholder for a year.

Method 3
Click Start, click Run, type winmsd.exe, and then click OK.
In the details pane, locate Processor under Item. Note the value.
If the value that corresponds to Processor starts with x86, the computer is running a 32-bit version of the Windows operating system.
If the value that corresponds to Processor starts with ia64 or AMD64, the computer is running a 64-bit version of the Windows operating system.

Microsoft Windows Server 2003

Method 1
Click Start, click Run, type sysdm.cpl, and then click OK.
Click the General tab. The operating system appears as follows:
For a 64-bit version operating system: Microsoft Windows Server 2003 Enterprise x64 Edition appears under System.
For a 32-bit version operating system: Microsoft Windows Server 2003 Enterprise Edition appears under System

Method 2
Click Start, click Run, type winmsd.exe, and then click OK.
In the details pane, locate Processor under Item. Note the value.
If the value that corresponds to Processor starts with x86, the computer is running a 32-bit version of the Windows operating system.
If the value that corresponds to Processor starts with EM64T or ia64, the computer is running a 64-bit version of the Windows operating system.

PhpMyAdmin asking for username password in the login screen.


Please follow the steps given below to change the cpanel password to avoid this from happening.

1) Login to cPanel with current password

2) Goto cpanel >> Preferences >> Change Password

3) Put OldPassword and NewPassword.

4) Keep “Allow MySQL password change” checked and then click on “Change your password now”.

You should get the output :
================================================== =
Your password has been changed!
The following services were updated (if any):

system

ftp

mail

mySQL <= important to get this (You will not see it if you uncheck “Allow MySQL password change”)

FrontPage (you will get this if frontpage is provided on the server)
================================================== =

5) Logout (Again important)

6) Login with new password and then go to cpanel >> Databases >> PhpMyAdmin

Now you should be able to get into the PhpMyAdmin without login Screen.

How do I change the IP that is used for any outgoing connection from my server in plesk ?


Default IP for an outgoing connections can be set using ‘ip’ utility.

First of all check how routing is configured on the server:

You can check this by following command :-

# /sbin/ip route
192.168.50.0/24 dev eth1 proto kernel scope link src 192.168.50.53
169.254.0.0/16 dev eth1 scope link
default via 192.168.50.254 dev eth1

If no ‘src’ listed in ‘ip’ output for default route, then main IP on the interface is used for an outgoing connections. You can change it using:

# /sbin/ip route change default via 192.168.50.254 dev eth1 src 192.168.50.100

Now:

/sbin/ip route
192.168.50.0/24 dev eth1 proto kernel scope link src 192.168.50.53
169.254.0.0/16 dev eth1 scope link
default via 192.168.50.254 dev eth1 src 192.168.50.100

Note: be careful, if you set wrong IP as source you lose link to the server.

OR 

 

If primary mail server ip address is  blocked in any spam checker sites ( eg BARRACUDA,SORBS-SPAM etc)  then there is only one solution, that is change the mail server ip address on the server.

You can easily change the mail server ip address in cpanel by using /etc/mailips file. The same as in PLESK you can also change the outgoing mail server ip address by using :-

[root@server] # /var/qmail/control/smtproutes .
1) first check the domain name which is hosted on the server by using following file

[root@server] # cat /var/qmail/control/rcpthosts
domain1.com
domain2.com
domain3.com
domain4.com
domain5.com

2) By default the “/var/qmail/control/smtproutes” file  is not present on PLESK server, you need to create it.

vi /var/qmail/control/smtproutes

3) Then add the new ip address in the following format.

domain1.com:192.168.0.2  ( Replace 192.168.0.2  with your IP and domain1.com with your domain)
domain2.com:192.168.0.2

4) Save the file and restart qmail

[root@server] # /etc/init.d/qmail restart

 

 

 

Installation & Configuration maldet (Linux Malware Detect – LMD)


Installation & Configuration maldet (Linux Malware Detect – LMD)

There is nothing special to installing LMD, download the package and run the enclosed install.sh script:

=======================================================================
CODE
root@server[~]# wget http://www.rfxn.com/downloads/maldetect-current.tar.gz
2010-05-15 23:34:05 (148 MB/s) – `maldetect-current.tar.gz’ saved [268031/268031]

root@server[~]# tar xfz maldetect-current.tar.gz
root@server[~]# cd maldetect-*
root@server[~]# ./install.sh
Linux Malware Detect v1.3.4
(C) 1999-2010, R-fx Networks <proj@r-fx.org>
(C) 2010, Ryan MacDonald <ryan@r-fx.org>
inotifywait (C) 2007, Rohan McGovern <rohan@mcgovern.id.au>
This program may be freely redistributed under the terms of the GNU GPL

installation completed to /usr/local/maldetect
config file: /usr/local/maldetect/conf.maldet
exec file: /usr/local/maldetect/maldet
exec link: /usr/local/sbin/maldet
cron.daily: /etc/cron.daily/maldet

maldet(32517): {sigup} performing signature update check…
maldet(32517): {sigup} local signature set is version 2010051510029
maldet(32517): {sigup} latest signature set already installed
=======================================================================

Now that LMD is installed, you need to open the configuration file located at /usr/local/maldetect/conf.maldet (with your favorite editor ie vi,nano etc ). The configuration file is fully commented so you should be able to make out most options but lets take a moment to review the more important ones anyways.
email_alert
This is a top level toggle for the e-mail alert system, this must be turned on if you want to receive alerts.

email_addr
This is a comma spaced list of e-mail addresses that should receive alerts.

quar_hits
This tells LMD that it should move malware content into the quarantine path and strip it of all permissions. Files are fully restorable to original path, owner and permission using the –restore FILE option.

quar_clean
This tells LMD that it should try to clean malware that it has cleaner rules for, at the moment base64_decode and gzinflate file injection strings can be cleaned. Files that are cleaned are automatically restored to original path, owner and permission.

quar_susp
Using this option allows LMD to suspend a user account that malware is found residing under. On CPanel systems this will pass the user to /scripts/suspendacct and add a comment with the maldet report command to the report that caused the users suspension (e.g: maldet –report SCANID). On non-cpanel systems, the users shell will be set to /bin/false.

quar_susp_minuid
This is the minimum user id that will be evaluated for suspension, the default should be fine on most systems.

The rest of the options in conf.maldet can be left as defaults unless you clearly understand what they do and how they may influence scan results and performance.

Usage & Manual Scans
The usage of LMD is very simple and there is a detailed –help output that provides common usage examples, I strongly recommend you check the –help output and spend a few minutes reviewing it.

The first thing most users are looking to do when they get LMD installed is to scan a certain path or series of paths. An important note is that LMD uses the ‘?’ character for wildcards instead of the ‘*’ char. In the below examples I will be using the long form flags but they are interchangeable with the short form flags (i.e: –scan-recent vs. -r).

If we wanted to scan all user public_html paths under /home*/ this can be done with:

root@server[~]# maldet –scan-all /home?/?/public_html

If you wanted to scan the same path but scope it to content that has been created/modified in the last 5 days you would run:
root@server[~]# maldet –scan-recent /home?/?/public_html 5
If you performed a scan but forget to turn on the quarantine option, you could quarantine all malware results from a previous scan with:

root@server[~]# maldet –quarantine SCANID

Similarly to the above, if you wanted to attempt a clean on all malware results from a previous scan that did not have the feature enabled, you would do so with:

root@server[~]# maldet –clean SCANID

If you had a file that was quarantined from a false positive or that you simply want to restore (i.e: you manually cleaned it), you can use the following:

root@server[~]# maldet –restore config.php.2384
root@server[~]# maldet –restore /usr/local/maldetect/quarantine/config.php.2384

Once again, I encourage you to fully review the –help output for details on all options and the README file for more details on how LMD operates.

You can also do the Daily scan by seetting the cron :-

Daily Scans
The cronjob installed by LMD is located at /etc/cron.daily/maldet and is used to perform a daily update of signatures, keep the session, temp and quarantine data to no more than 14d old and run a daily scan of recent file system changes.

The daily scan supports Ensim virtual roots or standard Linux /home*/user paths, such as Cpanel. The default is to just scan the web roots daily, which breaks down as /home*/*/public_html or on Ensim /home/virtual/*/fst/var/www/html and /home/virtual/*/fst/home/*/public_html.

 

Path to various log files in Plesk


Path to various log files in Plesk

Following is the list of path to different log files on a Plesk server.

Plesk Installation Logs:

root@server #/tmp/autoinstaller3.log

Plesk Upgrade Logs including other applications:

root@server #/tmp/psa-<app-name>…log

Plesk Access and Error Logs:

root@server #/usr/local/psa/admin/logs/httpsd_access_log
    root@server #/var/log/sw-cp-server/error_log

Plesk Migration Logs:

root@server #/usr/local/psa/PMM/logs/migration.log

WatchDog Logs on Plesk:

root@server #/usr/local/psa/var/modules/watchdog/log/monit.log

Apache Web Server Logs on Plesk:

root@server #/var/log/httpd/access_log
    root@server #/var/log/httpd/error_log

Apache Suexec Logs on Plesk:

root@server # /var/log/httpd/suexec_log

Access and Error Logs of a Website (account):

root@server #/var/www/vhosts/domain.tld/statistics/logs/access_log
    root@server #/var/www/vhosts/domain.tld/statistics/logs/error_log

Mysql Logs on Plesk:

root@server # /var/lib/mysql/server.hostname.err  (unless defined in /etc/my.cnf)

Named (Bind) Logs on Plesk:

root@server # /var/log/messages

Mail (Qmail and Postfix) Logs on Plesk:

root@server #/usr/local/psa/var/log/maillog

Ftp Logs on Plesk:

root@server #/var/log/messages

Server Logs on Plesk:

root@server #/var/log/messages

Horde Logs:

root@server # /var/log/psa-horde/psa-horde.log

Cronjob Logs:

root@server # /var/log/cron

SSH Logs:

root@server #/var/log/secure

Mailman Logs:

root@server #/var/log/mailman/

Tomcat Logs:

root@server #/var/log/tomcat5/catalina.out