Saturday, November 29, 2014

How to change main domain of a cPanel reseller account with an existing domain name?

 Here are some tips on cPanel reseller account modification. It’s quite simple if the new domain you wish to set as primary of your WHM re-seller is not under the same account. It can be simply managed from the “Modify an Account” section. You can simply modify the account information from this location. As it is a re-seller, you must do the following steps after modifying the account.

    Make sure that;You do not want the current domain and data. If you need it, please take backups.
    Change reseller ownership of all accounts under that reseller to the new username.
    Check resellers name-servers, if they are using their own.
    Switch reseller priveliges to new user.
    And so on.

Here I am listing some steps to changing the reseller main account that I have done few days ago for a client. His actual requirement is:

"Change the cPanel reseller account's main domain to an already existing domain under his reseller account"

He wants to set up “” (already existing under his re-seller account) as main domain for his re-seller account. Also, wanted to terminate the current main domain “”.

1, I created a backup of “” (The domain he actually wants to set as main domain).
2, Terminated that account “” (To avoid conflict when modifying the existing domain with new).
3, Modified the existing account with new domain name, I didn’t changed the $user name. The user name change will cause problem with all his accounts’ ownership and its little complex.
4, Replaced the “public_html” contents with the data from the backup I created.
5, Also, replaced the “email” folders with new.
6, As it was a WordPress site, created a database and restored it from the backup. (Need to edit the username details in database, makes sure that you have made the necessary changes in Site URL and home in your WordPress database).

That’s it…!!

Unable to establish a PHP session – PHPMyAdmin error

PHPMyAdmin error

Do you ever come across the following error when you access PHPMyAdmin from cPanel.
Access Denied Unable to establish a PHP session. If you believe that this is in error or inadvertent, contact your system administrator and ask them to review your server settings.

Normally, you will get this error when the permission or ownership of the tmp folder for this user is wrong. That is, make sure the ownership of /home/$username/tmp folder has ownership set to $user and permission as 755. If it is not, you will face the same problem.

1. SSH into the server as root.

2. Check the permission and ownership of /home/$user/tmp folder. Set ownership as $user.

# chown $user. /home/$user/tmp

3. Set permission of the tmp folder to 755.

#chmod 755 /home/$user/tmp

That’s it!!!

$user can be replaced with your respective username.

How to replace MySQL with MariaDB in cpanel

MariaDB is an enhanced drop-in replacement for MySQL. MySQL 5.1 is compatible with MariaDB 5.1, 5.2 and 5.3. MySQL 5.5 is compatible with MariaDB 5.5.

Make sure to save all existing data just in case there are any issues.

    cp -Rf /var/lib/mysql /var/lib/mysql-old
    mv /etc/my.cnf /etc/my.cnf-old

Disable the targets so cPanel no longer handles MySQL updates

The following will mark the versions of MySQL we distribute as uninstalled so they are no longer maintained by cPanel/WHM

    /scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
    /scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
    /scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled

How to Block an IP Address on a Linux server

To block an IP on your Linux server you need to use iptables tools  and netfilter firewall. First you need to log into shell as root user. To block an IP address you need to type the iptables command as follows:

# iptables -A INPUT -s IP-ADDRESS -j DROP

Replace IP-ADDRESS with your actual IP address. For example, if you wish to block an ip address 103.575.713.93 for whatever reason then type the command as follows:

# iptables -A INPUT -s 103.575.713.93 -j DROP

If you have IP tables firewall script, add the above rule to your script.If you just want to block access to one port from an ip 103.575.713.93 to port 22 then type command:

# iptables -A INPUT -s 103.575.713.93 -p tcp --destination-port 22 -j DROP

How to Setup Minecraft on a Linux CentOS Server

Installation is quite straightforward:

rm -fv csf.tgz
tar -xzf csf.tgz
cd csf

Next, test whether you have the required iptables modules:

perl /usr/local/csf/bin/

Don't worry if you cannot run all the features, so long as the script doesn't
report any FATAL errors