Featured Posts

Tips to Reduce Your Customer Support Costs When hosting websites, whether as a mainstream hosting provider, a hobby, or to supplement another service, it's your job to make sure your customers have access to technical support in case they need...

Read more

Roundcube: MySQL or SQLite? cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I've come to the conclusion that SQLite is definitely...

Read more

Simple Bash Script to Fix Account Permissions This is a simple bash script I wrote to fix the permissions and ownership of files within a cpanel account. To use, simply copy the script your server, chmod 755, and pass the usernames as arguments: ./fixperms...

Read more

Re-Installing Auxiliary cPanel Software Cpanel has a lot of supporting software that you may be using on your server. In case something goes amiss, here is a list of scripts that reinstall cpanel-provided software on your system. For most all...

Read more

10 Free Monitoring Solutions to Consider Server and network monitoring can be crucial to a host's success. I mean, how embarrassing is it when your customers are aware of downtime before you are? You don't have to pay big bucks or spend loads...

Read more

The cPanel Admin Rss

That Huge .cpan Folder in /Home

Posted by Mark | Tagged under: | Posted on June 16, 2010

0

A common question we get from cPanel administrators is whether it’s Ok to remove /home/.cpan since, on many servers, it tends to grow to a size exceeding 1G.  The short answer is yes – that folder is used by cPanel and Perl, and contains perl module installation files.

If you find that yours is occupying too much disk space, delete it, and run the following commands:

perl -MCPAN -e shell

cpan> install Bundle::CPAN>
cpan> reload index
cpan> reload cpan
cpan> exit

/scripts/checkperlmodules –full

Command Line PureFTP Configuration on cPanel

Posted by Vanessa | Tagged under: , | Posted on June 13, 2010

0

Ftp is easy to configure on a cPanel server using WHM or the pureFTP configuration file.  The FTP service configuration in WHM is a no-brainer, but for those looking to set up FTP from command line (such as for automation purposes), you can use cPanel’s built-in template system to apply configuration options that will not be overwritten during cPanel updates.

The pureFTP template is located in /var/cpanel/conf/pureftpd/main, and is set up YAML style similar to most of cPanel’s internal configuration files. The settings in the template correlate directly to the same options in /etc/pure-ftpd.conf, but it’s better to edit the template since cPanel tends to prefer template-based configuration to regenerate (overwrite) config files.

So let’s change an option in the FTP configuration. I’m going to change the LimitRecursion value from 2000 to 10000, which will allow the FTP server to display more than 2000 files in a single folder. To do this, I’ll edit the value in the template file mentioned previously, and then apply the changes using one of the WHM binaries invoked from command line:

/usr/local/cpanel/whostmgr/bin/whostmgr2 doftpconfiguration

What if I wanted to specify an option that isn’t in the template? Well, you can do this one of two ways:

1. Add the option to the template

If you do this, note the syntax in the other FTP options – yes and no are enclosed in single quotes, everything else is not. You also need to envoke doftpconfiguration via the whostmgr2 command as shown above.

2. Change the option to pure-ftp.conf

You can change an option in the FTP configuration file and run /scripts/ftpup –force, and the template will add the changed values to the template as long as they don’t already exist. If they do, the template will change the specified option in pure-ftpd.conf to match its own value.

Generally this would com in use if you’re automating server setups.  You can create a standard template for pureFTP, and download it to your server upon setup and update the configuration. This prevents you from having to modify anything manually, which can be a pain when deploying a large number of servers:

wget -O /var/cpanel/conf/pureftp/main http://yourrepo/pureftp/main

/usr/local/cpanel/whostmgr/bin/whostmgr2 doftpconfiguration

Additional Resources:

cPanel Documenation: FTP Configuration

Roundcube: MySQL or SQLite?

Posted by Vanessa | Tagged under: ,, | Posted on June 7, 2010

0

cPanel 11.25 introduces a new feature: The ability to have RoundCube use SQLite instead of MySQL. After benchmarking resource usage and performance, I’ve come to the conclusion that SQLite is definitely the best way to go for Roundcube. Having trouble making the decision? This article may help clear things up for you.

Managing Multiple Hard Drives with cPanel

Posted by Vanessa | Tagged under: , | Posted on June 6, 2010

1

If you have a server with single standalone drives, you may have considered the possibility of adding additional hard drives to provide more disk capacity to your system. Luckily, this is very easy to set up and use with cPanel.

First things first, I’ll assume that you already have the hard drive physically installed in your system. This guide will show you how to partition, format, and configure cPanel to use an additional hard drive, in the simplest way possible.

Changing the Shared IP Address of a Live Server

Posted by Vanessa | Tagged under: , | Posted on June 4, 2010

2

There may come a point in time where you need to change the shared IP address of a server, with little to no interruption in service for your users.

This guide will show you how to change the shared IP of your cPanel server with the method I’ve used in the past. This is intended for intermediate to advanced administrators that have some basic knowledge of cPanel and networking.  This will only update the main IP of your server, and will not affect accounts that have dedicated IPs or SSL certificates.

New cPanel Database Mapping Feature: Is it for You?

Posted by Vanessa | Tagged under: , | Posted on May 28, 2010

0

It was announced by cPanel on April 14, 2010 that cPanel 11.25.1 will include a new database mapping feature that’s been long requested: the removal of cPanel username prefixes from the database names.  This is a non-reversible, opt-in feature that some hosts may find very valuable. But is it a feature that you need?

Who is this feature for?

  • Hosts migrating entire servers from other control panels like Plesk or Ensim
  • Single-customer environments

Who is this feature not for?

  • Shared hosting providers
  • Larger-scale hosts

The concerns that are initially raised is in regards to shared hosting servers. With the new database mapping feature turned on, if one user takes a database name, no one else on the server can use it. Additionally, you’re creating a conflict if you move that user from one server to another, where the recipient server already has a user with that database name.  For these reasons alone, I would not advise this option being enabled for the general shared hosting provider, if the end users are going to be allowed to pick database names.

One of the advantages of cPanel is that you can move accounts between cPanel servers, even those from other hosts. If one host has the new mapping feature enabled, and one doesn’t (or has an older version of cPanel), you’re likely going to have a problem. For hosts with high conversion rates, this can be a deal breaker if the ease of moving cPanel accounts from other hosts isn’t there anymore.  This feature also creates a break in the standardization that all cPanel servers inherently have.  Most users by now that have already used cPanel know about the current database naming scheme, so enabling this feature without any technical justification can also create confusion among users that are familiar with and have been using cPanel for a long time.

Update: A rep from cPanel added this comment:

As cPanel 11.25.0 builds 46057 and higher, accounts transferred from a cPanel 11.25.1 system will preserve the YAML mapping file. Any databases and database users that lack the old-style prefix will not be manageable in the 11.25.0 cPanel interface, but the information is at least retained for later use (e.g. if a system with such an account is later upgraded to cPanel 11.25.1+ then the pre-existing YAML file will be updated and the databases and user will be manageable in the cPanel interface).

On the other hand, this feature is extremely valuable for hosts converting from other control panels or fulfilling requirements of single-customer environments. Other control panels do not prefix usernames to the database name, so large transfers would be especially painful for a cPanel host that acquires a non-cPanel host. The new mapping feature will help eliminate downtime due to incorrect database connection parameters and the need for mass reconfiguration.

Finally, for hosts that offer VPS and Dedicated hosting to single-customer environments, it’s nice to finally be able to remove the prefix that annoys web developers and IT people in charge of moving their customer sites.

So while this new feature is exciting, it’s opt-in for a reason – and that doesn’t mean it’s right for your hosting setup.

Additional Information:

http://www.cpanel.net/blog/integration/2010/04/a-general-overview-of-database-mapping.html
http://www.cpanel.net/2010/05/backwards-incompatible.html
http://www.cpanel.net/blog/integration/2010/05/more-details-about-db-mapping.html

Dealing With Hacked Sites

Posted by Mark | Tagged under: , | Posted on May 27, 2010

0

This article will not go into detailed technicalities on identifying, troubleshooting, tracing, and fixing hacks. These topics are far too broad to cover in a single article, and is outside the scope of this article’s intent. This guide is to help you, the system admin, come up with a plan to handle situations involving breached security.

Changing an FTP User’s Path

Posted by Vanessa | Tagged under: , | Posted on May 24, 2010

0

By default, your main FTP (cPanel) user will have and FTP path to the user’s home folder, and each FTP user you create after that will have a path that you specify with you create the account in cPanel > FTP accounts.

Unfortunately, cPanel’s interface does not currently let you change the FTP paths for your main account or sub-accounts, but you can easily change these in the FTP user configuration files. Each cPanel user has a file in /etc/proftpd (yes, even if you use pure-ftp), which contains the information about the FTP users for that account. A sample FTP user file for the cPanel ‘user1′ may look like this:

newuser:$1$K4v6EN_V$gmV/YZVYP1w/oJRy/72cg.:2110:2098:user1:/home/user1/public_html/newuser:/bin/ftpsh
user1:$1$21PI_llg$mkBe12xsL2K3YZPSkM.3..:2110:2098::/home/user1:/bin/ftpsh
user_logs:$1$21PI_llg$mkBe12xsL2K3YZPSkM.3..:2110:2098:user1:/usr/local/apache/domlogs/user1:/bin/ftpsh

If you want to change the FTP root for any of the users, simply make the change in this file and restart your FTP service.

Accessing cPanel Through A Firewall

Posted by Vanessa | Tagged under: ,, | Posted on May 23, 2010

0

There’s been a long-standing issue from a hosting provider’s point of where cPanel runs on abnormal ports, causing users behind firewalls to be unable to access cPanel. At first, there was cpanelproxy.net which offered (at that time) an automated script that users could install on their hosting accounts to route cPanel traffic over port 80. Around the time that cPanel 11 came out, the script no longer worked, and users behind corporate or school firewalls were out of luck.

cPanel 11 introduced its own proxy to allow users to get around firewall restrictions.

To enable this feature without inconveniencing users, check these three options in WHM > Tweak Settings:

Add proxy VirtualHost to httpd.conf to automatically redirect unconfigured cpanel, webmail, webdisk and whm subdomains to the correct port (requires mod_rewrite and mod_proxy)

Automatically create cpanel, webmail, webdisk and whm proxy subdomain DNS entries for new accounts. When this is initially enabled it will add appropriate proxy subdomain DNS entries to all existing accounts. (Use /scripts/proxydomains to reconfigure the DNS entries manually)

Allow users to create cpanel, webmail, webdisk and whm subdomains that override automatically generated proxy subdomains

*Keep in mind that if you’re establishing these settings on an existing server, it’s going to update the zones for each domain on the server and synchronize them out to the DNS cluster. This got us in trouble once, as we had a number of suspended accounts on a server that ended up having their DNS reverted back when the proxy subdomains were updated.

To enable proxydomains for the whole server:

/scripts/proxydomains add

To enable for all domains on one user’s account:

/scripts/proxydomains –user=<user> add

To enable for a single domain:

/scripts/proxydomains –domain=<domain> add

To remove proxy domains, use the same commands as above, only use “remove” instead of “add”. From here, you can access the proxy at http://cpanel.domain.com (or webmail/whm, respectively), or access cPanel normally and let it detect whether you are behind a firewall.

Setting Up Wildcard DNS with cPanel

Posted by Vanessa | Tagged under: , | Posted on May 21, 2010

0

Wildcard DNS allows a server to display and combination of subdomains for a website. For example, wildcard DNS for thecpaneladmin.com will allow any subdomain to resolve to this website, even if they have not been specifically created.  Subdomains that have been created individually in cPanel will still route to their respective folders, but anything else will go to the document root of the domain the subdomains are based on. Wildcard DNS is most used for implementation of applications like WordPress MU. To set up wildcard DNS:

In the DNS zone for the parent domain, simply create an A  or CNAME record for *. For example, either of these will work:

*   IN   A   5.5.5.5

*   IN CNAME mywebsite.com.

Now on the server, edit /var/cpanel/userdata/$user/$parentdomain, and look for the serveralias line. This is where the parked domains/aliases for a domain are listed, so you just need to append *.parentdomain to the same line. A serveraliase line for thecpaneladmin.com may look like this:

serveralias: www.thecpaneladmin.com thecpaneladmin.net www.thecpaneladmin.net *.thecpaneladmin.com

Now run:

/scripts/rebuildhttpdconf

And restart Apache. You can test the Wildcard subdomains by going to any subdomain of the parent domain, and it should go to the parent domain’s site. This may not be what you wanted it to do though. With wildcard DNS and virtualhosts, you need an .htaccess rewrite to redirect the subdomains. For example:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !www.domain.com$ [NC]
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).domain.com [NC]
RewriteRule (.*) %2/$1 [L]
</IfModule>

In the above example, if your subdomain is test.domain.com, the rewrite will send you to http://domain.com/test/page.html. You can modify the rewrite accordingly to achieve the results you want.

Keep in mind that the Apache configuration has to be done by someone with access to the user’s Apache config files, as you can’t add *.domain.com to cPanel as a subdomain or parked domain at this time. cPanel may change this in the future, but for now it’s something that the end user cannot do without administrator access.