Danger behind cPanel account restore – Shared hosts..be careful!

Today I have been playing with my test cPanel server. I thought to have some look into the reseller settings today and I found a serious anomaly while my works. On now..what it is…

I know very rarely we need the “All Features (warning: total and complete access)” privilege granted for a reseller. Because that privilege will give root level access to the reseller on the server, which is not allowed. So generally no-one with a root level WHM access is not able to create a reseller with all privileges. So it is obvious that anyone with root privilege ( like VPS owners ) can create “all privilege” reseller. Now what happened when we restore such a reseller to a server? What changes does it make compared to a normal user or a reseller without any privilege? So far I couldn’t find any. I couldn’t find any specific messages or difference in restore process for a normal user, reseller without “all” privilege” or with “all” privilege. I could find the following common message only with any of them ( in fact the admins I found don’t worry about the restore messages until they find any specific error while restoration )

Read more

strict warning: Non-static method view – Drupal warning messages – Drupal / PHP 5.4

As E_STRICT is now the part of E_ALL from PHP 5.4 ( Reference http://us.php.net/ChangeLog-5.php#5.4.0 ), this warning can pop-up on most systems with Drupal + PHP 5.4 because usually E_ALL is set as the default error reporting for PHP. Also PHP 5.4 is not officially supported by Druapl. Using a supported PHP version also can resolve issues with Drupal views ( Refer https://drupal.org/requirements/php for Druapl’s PHP requirements )

Anyway we need to use PHP 5.4 for Druapl and to avoid such warnings to display in the website. Disabling E_STRICT in php.ini didn’t help, because Druapl defines its own error reporting function. So we had to make the following changes to the Druapl core files, as per the information collected from their forum.

1. Open /includes/bootstrap.inc

In the beginning of function drupal_set_message and  below “if ($message) { ” line, put the following  code

Read more

mysqli_connect(): (HY000/2002): Can’t connect to local MySQL server through socket – SugarCRM – cron.php

PHP Warning: mysqli_connect(): (HY000/2002): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in sugarcrm/include/database/MysqliManager.php on line We have faced such an error with SugarCRM today. The above error was reporting in error_log file every time the cron.php is executed via cron job. We have taken a closer look and couldn’t find any real reason why … Read more

Remove old backups from rdiff-backup backup point – rdiff backup remove old increments

Remove old backups from rdiff
Importance of Backups in Hosting Industry

In the hosting industry, sudden failure of a hard disk can cause sleepless nights for server owners and can cause a bad reputation company as well. Also having proper remote backups is an added advantage to the customers as well and can attract some customers as well due to this. Rdiff-backup is one such tool which is having great features that every hosting owner will wish to have. 

What is Rdiff-backup

Rdiff-backup is a powerful remote backup tool that is based on python.

Rdiff-backup backs up one directory to another possibly over the network. The target directory will have a copy of the source directory but extra reverse diffs of that directory are stored in a subdirectory which will help us to recover files from long ago. In this tool, they have combined the features of mirroring and incremental backups. 

Rdiff-backup preserves subdirectories, hard links, uid/gid ownership (provided this is running as root), resource forks, modification times, permissions, etc which makes this a perfect tool for backups 

In this blog, we mainly discuss only the removal of old backups. 

How to remove old backups from rdiff-backup properly 

To remove old backups from rdiff-backup ( so-called increments ), you can use “–remove-older-than” option of rdiff-backup command. You should have to specify the “time from which” value as well along with that switch. The rdiff-backup tool provides the flexibility to define that time_spec value in years, months, weeks, days, hours, minutes, and seconds. Each representation is given below.

To Remove backups older than one year, use the below 

–remove-older-than 1Y 

To Remove backups older than one month, use the below 

–remove-older-than 1M 

To Remove backups older than one week, use the below 

–remove-older-than 1W

To Remove backups older than one hour, use the below 

–remove-older-than 1h 

To Remove backups older than one minute, use the below 

–remove-older-than 1m 

To Remove backups older than one second, use the below 

–remove-older-than 1s 

The entire command to remove backups ( increments ) should look like following

Read more

Premature end of script headers: wredirect.cgi

If you are getting Internal Server Error while doing /webmail /whm /cpanel , please check the apache error log.

For us it was like the below error

[Tue Oct 08 08:14:44 2013][error][client x.x.x.x] Premature end of script headers: wredirect.cgi
[Tue Oct 08 08:14:44 2013][error][client x.x.x.x] File does not exist: /home/user/public_html/500.shtml

A temporary fix is to disable Suexec from WHM from the drop down at  Home »Service Configuration »Configure PHP and suEXEC and save. But in this case you are compromising the security.

This is actually a known bug  and if you are using cagefs then please do the below steps to fix this permanently

cagefsctl --remount-all
service proxyexecd restart

Read more

Linux Shell Scripting – An Introduction

Linux Shell Scripting

Scripts are collections of commands that are stored in a file. The shell can read this file and act on the commands as if they were typed at the keyboard. The shell also provides a variety of useful programming features to make your scripts truly powerful.

Write a simple shell script

Use an editor software to write the script. The following is the simplest “Hello World” program.

#!/bin/sh
# My first script
echo "Hello World!"

and save the above script to the file name “myScript.sh”

We can use any name for saving the script. but here I am using “.sh” extension for my script, since the shell used here is “/bin/sh”. Also it will help us to identify the scripts from a other files and folders.

Read more

How to check a website in a remote server before DNS change

In all migrations, we may wish to check the domain’s functionality and fix any errors preset  to make the dns change smoother and perfect. So just thought to add this in our blog too 🙂

Some control panel offer site preview, especially Plesk using which we can take a look on domain  hosted in that domain. But in others like cPanel, Directadmin and those without any control panels, we may need to check this using  local hosts file or by changing the A record on a temporary basis.

Best method is to check websites using your local “hosts” file in your PC / Laptop. Below is the steps using which one can test a website hosted in a remote server without changing the name server.

For Windows

1.  Locate the hosts file in your computer. Typically it is in one of the following locations:

Windows NT/2000/XP/2003/Vista/7   —     C:\windows\system32\drivers\etc\hosts
Windows 95/98/Me                                         —     C:\windows\hosts

Read more