Thursday, 6 March 2014

How long does it take to refresh my DNS cache?

The cache is cleared over a certain amount of time. We suggest waiting up to 24 hours for the DNS cache to be fully refreshed. DNS will refresh according to the "TTL" or "Time To Live". When the DNS refreshes according to its TTL, the propagation is complete and your site will load.

CSH script does not show any output for non cPanel user

If the csh file not showing any output while executing a .csh file for a non cPanel user then it is because of the file “/etc/profile.d/locallib.csh” .

Apply the below fix for this ::

open the file : /etc/profile.d/locallib.csh and replace the code : eval $(perl -Mlocal::lib) with eval perl -Mlocal::lib

So it should show the output as ::

 cat /etc/profile.d/locallib.csh

#cPanel Added local::lib -- BEGIN
setenv LOCALLIBUSER $USER
if ( -e /usr/bin/whoami ) then
        setenv LOCALLIBUSER `whoami`
endif
if ( "$LOCALLIBUSER" != "root" ) then
    eval `perl -Mlocal::lib`
endif
#cPanel Added local::lib -- END


instead of

cat /etc/profile.d/locallib.csh

#cPanel Added local::lib -- BEGIN
setenv LOCALLIBUSER $USER
if ( -e /usr/bin/whoami ) then
setenv LOCALLIBUSER `whoami`
endif
if ( "$LOCALLIBUSER" != "root" ) then
eval $(perl -Mlocal::lib)
endif
#cPanel Added local::lib -- END

Saturday, 1 March 2014

Domain pointing to external MX on plesk

If you domain uses external MX record and it is hosted on linux plesk server then you need to change the setting on Plesk.


Here is what you need to do to achieve the task.

1) Update the DNS for the Domain


  • Change/Add MX records to set external email server with relevant priorities

  • Either remove the CNAME for mail.domainname.com(if not to be used for configuration) OR

  • Edit CNAME for the domain which will point to external email server (usually provided by email service provider) OR

  • Add A record for mail.domainname.com to point to external email server

  • This will take some time (12 to 24 hours) to propagate the changes made in DNS.




2) Once the DNS is configured to use external email server, it is necessary to de-activate the Mail service for the domain from the Plesk.


  • Login to Plesk as admin

  • Domains

  • Search and go into the Domain

  • Click on ‘Mail’ (has drop down options)

  • Click on ‘Mail Settings’ (other option is ‘Create Mailing List’)

  • Under Mail Preferences Uncheck the option “Activate mail service on domain”

  • Click ‘OK’ button to save the settings.



The Above settings must remove the entry for the domain from the following two “qmail” server configuration files.

=> /var/qmail/control/rcpthosts
=> /var/qmail/control/virtualdomains

After removal of above to entries, server will look for the external email server for that domain by fetching MX records from its DNS

Friday, 28 February 2014

ERROR! MySQL is not running, but lock exists : MySQL ERROR

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

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 doesn't 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

Note : There could be some chances that your disk usage 100% full.

root@server [~]# df -h

If that one is usr, var or tmp then you can remove old logs.

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

 

Tuesday, 11 February 2014

How to install ConfigServer Apps On A cPanel/WHM Server ?

ConfigServer provide a range of paid and free applications, including a significantly more advanced firewall, that plug directly into WHM on your cPanel server. These applications are highly recommended for anyone who is serious about the security of their cPanel Server, as they not only provide enhanced security functionality, but also allow you to easily manage a number of other basic cPanel functions, such as mail settings, mail queues, and a more advanced ModSecurity tool.



Below is a list of the free applications that we will be providing the simple installation instructions for:




  1. CSF - this is an advanced firewall system utilising Linux ip tables

  2. Mail Manage – allows you to adjust mail settings, such as hourly limits and email forwarders, on a per account basis

  3. Mail Queues – easily manage your email queues with the ability to force run the queue and delete stuck messages

  4. ModSecurity Control – if you have installed ModSecurity on your cPanel Server, this provide an advanced management interface

  5. Explorer – This is a file system explorer web interface which allows you to also run basic shell commands within folders – WARNING: While this utility can be very useful it is also very dangerous indeed. You can easily render your server inoperable and unrecoverable by performing ill advised actions. No warranty or guarantee is provided with the product that protects against system damage.



NOTE: All of the installations below require you to be logged into SSH as root.


Install ConfigServer Security & Firewall



rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh



Remove installation files:



cd ..
rm -Rfv csf/ csf.tgz



Install ConfigServer Mail Manage



rm -fv cmm.tgz
wget http://www.configserver.com/free/cmm.tgz
tar -xzf cmm.tgz
cd cmm
sh install.sh



Remove installation files:



cd ..
rm -Rfv cmm/ cmm.tgz



To uninstall:



rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmm.cgi
rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmmversion.txt
rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmm/



Install ConfigServer Mail Queues



rm -fv cmq.tgz
wget http://www.configserver.com/free/cmq.tgz
tar -xzf cmq.tgz
cd cmq
sh install.sh



Remove installation files:



cd ..
rm -Rfv cmq/ cmq.tgz



To uninstall:



rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmq.cgi
rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmqversion.txt
rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmq/



Install ConfigServer ModSecurity Control



rm -fv cmc.tgz
wget http://www.configserver.com/free/cmc.tgz
tar -xzf cmc.tgz
cd cmc
sh install.sh



Remove installation files:



cd ..
rm -Rfv cmc/ cmc.tgz



To uninstall:



rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cmc.cgi
rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cmcversion.txt
rm -Rfv /usr/local/cpanel/whostmgr/docroot/cgi/cmc/



Install ConfigServer Explorer



rm -fv cse.tgz
wget http://www.configserver.com/free/cse.tgz
tar -xzf cse.tgz
cd cse
sh install.sh



Remove installation files:



cd ..
rm -Rfv cse/ cse.tgz



To uninstall:



rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/addon_cse.cgi
rm -fv /usr/local/cpanel/whostmgr/docroot/cgi/cseversion.txt



If you run into any issue with the install, just head over to the ConfigServer forums and you’ll find plenty of people who can assist you.

How to allow Anonymous users to create a new directory and write to that directory?

We need to edit the parameter ‘anon_mkdir_write_enable’ and set it’s value to ‘YES’. But in order to make the parameter working, ‘write_enable’ must be activated. The default is NO.



# Uncomment this to enable any form of FTP write command.
write_enable=YES




# Uncomment this if you want the anonymous FTP user to be able to create
# new directories.
anon_mkdir_write_enable=YES

How to allow secured SSL connections to Anonymous users? How ?

Yes! It is possible to allow anonymous users to use secured SSL connections. The value of parameter ‘allow_anon_ssl’ should be ‘YES’ in the vsftpd.conf file. If it, set to NO it wont allow anonymous users to use SSL connections. The default value is NO.



# Add this line to enable secured SSL connection to anonymous users.
allow_anon_ssl=YES