Pages

Wednesday, September 4, 2013

How to reset default SSH port for cPanel/WHM

How to change/reset default SSH port on your cPanel servers?

Did you forget SSH port and try to reset it via WHM, Use the following  SSH configuration settings on WHM.

Login to your WHM on a non secure port that is : 2086
For example : http://serverip:2086

Then browse the URL to reset the SSH configuration settings :

http://serverip:2086/scripts2/doautofixer?autofix=safesshrestart

After running the script, the default port 22 will reset on your cpanel SSH configuration. You can login SSH and reset it.

That’s it !!




How to Backup and Restore Individual cPanel Account via SSH

Backing up your hosting account is very necessary for your business to survive on Internet. Whether it is a small or large business, you must backup all of your data regularly at least once a week. cPanel provides some great ready made scripts which will help you make your tasks more easy. Commands such as pkgacct is basically used for backing up cpanel web hosting accounts and restorepkg for restoring cpanel accounts via the SSH or command line interface.

How to create backup of Individual cPanel Account via SSH?

Step 1: Log-in to the SSH as Root user.

Step 2: Enter the following command string on the command line interface:

    /scripts/pkgacct username

[Note: The account backup will be created in the current directory you are in.]

How to Restore the Individual cPanel Account via SSH?

Step 1: To restore the cPanel account backups, enter the following command

    /scripts/restorepkg username

[Note: In order to restore the data, you need to be in the directory where the backup file is stored.]

How to Reset MySQL root Password

To provide multi user  access to number of databases a relation database management system is been developed that runs on a server and called as MySQL. MySQL is developed under GNU General Public License and its source code is available under its defined terms. MySQL is a popular choice of database for use in web applications and it performs really well with cPanel hosting accounts to store data of any websites. And suppose if you have forget the MySQL root password and you are not able to access your mysql service then you need to reset the password of MySQL root user by using following steps which are as follows,

Steps to Reset MySQL root Password :

1)root@server [~]/etc/init.d/mysqld stop

2)Start to MySQL server without password:
root@server [~]mysqld_safe –skip-grant-tables &

3) root@server [~] mysql
After that you can get the mysql prompt then run the following command

4)mysql >use mysql;

5)mysql >update user set password=PASSWORD(“NEWPASSWORD”) where User=’root’;

6)mysql > quit

7)root@server [~]/etc/init.d/mysqld stoproot@server [~]/etc/init.d/mysqld start
Now you can access your mysql service by using
[root@server ~]#mysql -u root -p

How to ban or block an IP address from visiting my website?

You can make use of .htaccess files in order to block an IP address from accessing your website. A .htaccess is a kind of configuration file that can be used from things like setting password-protected directories, preventing the display of file extensions to, of course, restricting access based on IP.
To ban an IP address from accessing your website, create a .htaccess file within your root directory (usually public_html or www) and add the following configuration in the file:
order allow,deny
deny from 127.0.0.1
allow from all

How to Upgrade mod_pagespeed

Inorder to upgrade the mod_pagespeed module, you must first download the latest version and make use of the command “yum localinstall mod-pagespeed-*.rpm” for the purpose of installing http://code.google.com/speed/page-speed/download.html
Use the below commands to upgrade the package :
sudo yum update
sudo /etc/init.d/httpd restart

Simple PHP Script for RBL Checking

It’s useful for ISP’s and email service providers to run occasional RBL checks against their IPs to know when they are being blacklisted by populate CBL services. I’ve written a simple script that utilizes the DNSBL pear library to check against common blacklists, when given a list of IPs in a file.
First, you need to download or install the NET_DNSBL pear module. (Command: pear install NET_DNSBL)

<?php
require_once('Net/DNSBL.php');

$iplist = file("/path/to/iplist");
foreach ($iplist as $ip){
$dnsbl = new Net_DNSBL();
$dnsbl->setBlacklists(array(
'sbl-xbl.spamhaus.org',
'dnsbl.sorbs.net',
'bl.spamcop.net',
'dnsbl-1.uceprotect.net',
'dnsbl-2.uceprotect.net',
'dnsbl-3.uceprotect.net',
'isps.spamblocked.com',
'zen.spamhaus.org'
));

if ($dnsbl->isListed($ip)) {
echo "IP $ip is blacklisted!\n";
}
else {
echo "IP $ip not listed\n";
}
}

?>

This checks your IP's to a RBL listing so you can take appropriate action against abusers.