Yearly Archives: 2010

Howto: Disable MailMan

Howto: Disable MailMan

To disable Mailman on a cPanel server, remove the execute permissions of the mailman wrapper

Code:
chmod -x /usr/local/cpanel/3rdparty/mailman/mail/wrapper

If you ever want to enable it:

Code:
chmod +x /usr/local/cpanel/3rdparty/mailman/mail/wrapper

How to Password Protect Directories Detailed Tutorial

How to Password Protect Directories Detailed Tutorial

Please select the Password Protect Directories icon from your cPanel main page. A list of the directories on your account will appear.

Select the directory you wish to limit access to. In the new page, please create a username and a password for your user. Select a name that will appear in the login screen and click on the Save button to activate the protection.

Please note that you have to create a directory before you enable the password protection for it. Also, using one and the same directory for the purpose of password protection and FTP storage in the same time is not recommended.

It is also important to add that password-protecting your webroot (the www directory) will lead to inability of your website to be displayed directly.

Warning: MaxClients exceeds ServerLimit

You may reach the maximum number of clients that are allowed to connect to your Apache web server and Apache stops responding.

In this case, you have to increase the MaxClients and ServerLimit variable to a higher value.

The changes has to be placed in the Apache configuration file located at /usr/local/apache/conf/httpd.conf but in case of Apache 2.x version or higher, you may not be able to save the changes directly and a restart of Apache service will reset the values of the two directives.

You may receive the following warning message on restarting the Apache web service:

Code:
WARNING: MaxClients of 500 exceeds ServerLimit value of 256 servers, lowering MaxClients to 256. To increase, please see the ServerLimit directive.

In order to overcome the error, you need to execute the following two commands to make the changes permanent.

Code:
/usr/local/cpanel/bin/apache_conf_distiller –update –main
/usr/local/cpanel/bin/build_apache_conf

This will also prevent any changes to overwrite on the next cPanel update.

WHM unable to create or remove accounts

1) Check your /etc/resolv.conf. If its missing valid nameservers this can be the cause

Code:
dig . NS

If this times out then this is the problem. You have to fix your /etc/resolv.conf

2) Make sure you aren’t missing perl modules or have 11.x scripts on a 10.x machine

r

Code:
un
 /scripts/perlinstaller File::Copy::Recursive
/usr/local/cpanel/bin/checkperlmodules –bootstrap
/usr/local/cpanel/bin/checkperlmodules –full

If you want to keep 10.x:

Code:
echo “CPANEL=stable” >> /etc/cpupdate.conf
 /scripts/upcp –force

cPanel sshd has failed, please contact the sysadmin

If you have changed the shell default Port 22 on a cPanel powered server , restarting sshd from the WHM will fail. You have to ssh to the server and issue the following command to restart sshd…

  • Code:
    /sbin/service sshd restart

To, temporarily, reset your shell port back to 22, run the following command from the Address field in browser:

Code:
SERVER_MAIN_IP:2087/scripts2/doautofixer?autofix=safesshrestart

Now, you should be able to access shell, and you need to restart sshd at the prompt using the command mentioned above

How can i install cURL on my cPanel server?

There are two common types of cURL installs on most cPanel servers. The first is a binary install, this is where the cURL binary (program) sits on your server (usually in /usr/bin) and can be run via the CLI or script. The second method is to have cURL built into PHP so that PHP’s cURL functions can be used in PHP code. Below explains how to install each.
Installing the Binary Version on All versions of CentOS/RHEL/Fedora:

1. Log into the server via SSH or console as root.
2. Run the following command:

PHP Code:
yum install curl curl-devel

3. When prompted to confirm the installation press y.

CURL is now installed and should reside in /usr/bin/curl
Adding cURL support into PHP:

1. Log into the server via SSH or console as root.
2. Run the following command:

PHP Code:
/scripts/easyapache

3. Select ‘Start customizing based on profile’, leaving ‘Previously Saved Config’ checked.
4. Select the version of Apache you would like to run.
5. Select the branch and version of PHP you would like on the next two pages (it is not recommended to run both PHP 4 and 5).
6. Select ‘Exhaustive Options List’ on the following page.
7. Scroll down to the PHP configuration section to cURL, and proceed to th enext stop (cURL-SSL can also be enabled).
8. Select ‘Save and Build’, and let the compilation run its course (usually takes 15-20 minutes).

The system will now recompile PHP with cURL support!

CPanel: Backup and Restore a Domain Account via SSH

CPanel: Backup and Restore a Domain Account via SSH

Sometimes there is a need to backup a CPanel account without logging into the endusers CPanel yourself.

In those situations the account can also be backed up via SSH.

Every CPanel server comes with scripts that can be executed via SSH.

In this case we will use the script:

pkgacct from the /scripts folder on your server.

1. Log into your server by using SSH
* Change to the root user
su – root

(See our server security tutorial for more information on this login procedure)

2. Change directories to the script directory by executing the following command:

cd /scripts

3. Execute the CPanel script for the account backup:
./pkgacct username

(replace the username with the actual acount username that you are going to backup (/scripts/./pkgacct username))

The screen output will look similar to this:

Copying domain Config…Done
Copying Mail files….Done
Copying proftpd file….Done
Copying www logs…Done
Grabbing mysql dbs…Done
Grabbing mysql privs…Done
Copying mailman lists….Done
Copying mailman archives….Done
Copying homedir….Done

4. The backup file will be placed in the users home directory.
You can now access the file and copy or move it to your backup drive or download it via ftp.

How to restore a Domain Account via SSH
1. Upload or copy the backup file (Example File Name: cpmove-joeuser.tar.gz) to the domain account Home directory via FTP.

2. Log into your server by using SSH
* Change to the root user
su – root

(See our server security tutorial for more information on this login procedure)

3. Change directories to the script directory by executing the following command: cd /scripts

4. Execute the appropriate CPanel script for the account restore:
/scripts/restorepkg username

(replace username with the domain account username)

(make sure that the file name matches the necessary naming convention – follow the naming scheme seen in our example)

This will restore the domain account from the backup, as well as it will create the CPanel account.