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

Adding New Feature Groups for a cPanel Theme

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

0

You’ll probably often see hosts that have a ton of extra icons in their cPanel for various items. When you’re customizing cPanel, it’s useful to be able to be able to add icon groups for features that either need to be grouped together, or that don’t fit into other categories.  cPanel 11 makes it very easy to customize how icons are presented.

Create the Group

First, you’ll want to create your icon group.  The group will contain features/plugins that you create and assign to the group. Here’s a very basic example of a Twitter plugin that was created as part of a separate group called “Extras”:

First, we’re going to create the “Extras” group:

If you’re using the x3 theme, go into /usr/local/cpanel/base/frontend/x3/dynamicui . Create a file based on your new menu, prefaced with dynamicui, and ending in .conf. For example, I’m creating a group of icons that I want to be under a group called “extras”, so the file I create will be called dynamicui_extras.conf .

In the dynamicui_extras.conf file, all on one line, I’ll add the properties for my group, making sure everything is on one line:

groupdesc=>Extras,description=>extra icons,grouporder=>-100,group=>extras_menu,
imgtype=>icon,subtype=>img,type=>image,file=>extras,height=>32,width=>32

*Above info may be wrapped for display purposes, but in the file it should all be on one line

The settings here should be fairly self-explanatory, but here are the main elements:

  • groupdesc: The label that will show up in cPanel for the group heading
  • description: Describes the group (not shown in cPanel)
  • grouporder: Where the group will show up in the cPanel interface (accepts negative values, lowest number is highest up)
  • group: The name of the group, used when generating cPanel plugins

The rest of the values should be inputted as above, and just put the file value as the name of the group.  Now, save the file and reload cPanel. If you have active feature in this group, you should see the group and its icons appear when loading cPanel. If you don't see it, it means that either you don't have any features as part of the group, or your features are not configured correctly. So let's do that now!

Create Plugins (Features)

Cpanel plugins are basically items in cPanel that add functionality, and are enabled/disabled in WHM's Feature Manager. To create a plugin, simply use the cPanel Plugin Generator.  Notice that in the form, there's an option for Display Group - you can choose any of those for now, since you're just going to change it later.

Once you've generated and downloaded the plugin, open the plugin file and edit the group line.  This should reflect the value you put as group for the group you created earlier, so in my example, the line should read:

group:extras_menu

To install the plugin, copy the file to /usr/local/cpanel/bin and run:

/usr/local/cpanel/bin/register_cpanelplugin /usr/local/cpanel/bin/<pluginfilename>

You should now see the icon and group in cPanel. If you don't, you can try rebuilding the sprites:

/usr/local/cpanel/bin/rebuild_sprites

Resources:

cPanel Documentation: Installing Plugins

cPanel Documentation: Adding Icons and Groups

Installing ClamAV on a cPanel Server

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

0

ClamAV is an popular open source anti-virus toolkit for *nix, and while many people don’t find much value in using antivirus software on Unix, it is very useful for email scanning.  cPanel’s implementation allows end users to run scans on their home folders, public FTP folders, mail, and public_html.

It’s really hard to install ClamAV on cPanel – if you’re too lazy to click a couple buttons.  Simply go to WHM > Manage Plugins and enable the ClamAV Connector, and you’re good to go.

After this is done, you can go to WHM > Configure ClamAV Scanner and set scanning options for the entire server or specific users:

You should now see a Virus Scanner option in cPanel. If you don’t, you may need to enable it in Feature Manager.

From here, cPanel users can run scans on any permitted items.

For administrators, here are a few quick commands that may be useful:

Update antivirus database:

freshclam

Scan a directory and print out infected files:

clamav -ri /home

Scan a directly and remove infected files and emails:

clamav -ri –remove /home

Overview of PHP Handlers

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

0

One user on the cPanel forums spent some time summarizing the four PHP handlers,currently available via EasyApache, into a neat little chart that makes it easy to do a quick comparison. With that user’s permission, I’m posting the chart here:

Click on the image for the original-sized diagram. Thanks to Miraenda from errorcodex.com for providing it!

cPanel Conference 2010

Posted by Vanessa | Tagged under: | Posted on July 30, 2010

0

cPanel Automation BootcampI’m excited to announce that this year I will be speaking at the  cPanel conference, so if you haven’t yet registered, make sure you do it soon!  The conference will be held in cPanel’s hometown of Houston, TX at the Westin Oaks Hotel between Oct 4-6,2010.

My topic specifically will be covering full server automation from start to finish, essentially showing you how to deploy fully-configured cPanel servers with even touching a bash prompt.  You’ll learn where cPanel stores it configuration files, how to configure services using cPanel’s service templates, and what scripts will save you time by automating simple tasks.

Hope to see everyone there!

Update: Use the code cpanel-twitter to get 25% off your registration fee!

Skipping the WHM Setup Wizard on New Servers

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

1

If you have a fully automated cPanel/WHM setup method used to deploy a large number of servers, you’ve probably found it to be annoying that upon loading WHM for the first time, you’re greeted with a setup wizard that you have to click through.  To skip this wizard, all you need to do is touch a file:

touch /etc/.whostmgrft

This will tell WHM to skip the setup wizard altogether. However, if you haven’t already, you’ll want to add the following pieces to your automation which are usually configured in the setup wizard:

  • IMAP – /scripts/setupmailserver (courier | dovecot  | disabled)
  • DNS – /scripts/setupnameserver (bind | nsd | disabled)
  • FTP – /scripts/setupftpserver (pure-ftpd | proftpd | disabled)

You should also create the /etc/wwwacct.conf file, with the following contents:

ADDR 123.456.789.123
CONTACTEMAIL your@emailaddress
CONTACTPAGER
DEFMOD x3
ETHDEV eth0
FTPTYPE pureftp
HOMEDIR /home
HOMEMATCH home
HOST server.domain.com
LOGSTYLE combined
MINUID
NS ns1.yourdomain.com
NS2 ns2.yourdomain.com
NS3
NS4
NSTTL 86400
SCRIPTALIAS y
TTL 14400

Derived from : http://www.cpanel.net/blog/integration/2010/05/skipping-the-whm-getting-started-wizard.html

Allowing Users to Customize AwStats

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

0

You can allow users to use their own configuration file for AwStats in case they are in need of customizations not provided by the server’s main config.  To enable this option, add the following to /etc/stats.conf:

allow_awstats_include=1

Alternatively, you can go to WHM > Statistics Software Configuration, and click on Allow Awstats configuration Include file

This will allow users to have an awstats.conf.include file in /home/$username/tmp/awstats, which can be used to override settings from the main AwStats configuration for the server.

Manually Rearranging Accounts

Posted by Vanessa | Tagged under: , | Posted on July 14, 2010

0

There was a situation today where I had to mass-move a bunch of accounts from one partition to another.  WHM’s Rearrange an Account function does this one account at a time, but to move over 50 of them, a more scripted solution was necessary.  Here’s how I did it on a live server without causing any downtime:

Scenario: Moving over 50 cPanel accounts from /home4 to /home3 on a live dedicated server

Step 1: Grab the list of users

Done with a simple one-liner:

for user in `cat /etc/passwd | grep /home/ | cut -d: -f1` ; do echo $user >> /root/users ; done

Step 1: Rsync all the data over

This part can be fairly CPU-intensive, so you may want to bandwidth-limit or renice the rsync which will slow the transfer, even if done locally. You need to copy the data on one disk to the other:

for user in `cat users` ; do rsync -av --bwlimit=8000 --delete /home4/$i /home3 ; done

You may want to run this command a few times depending on how much data is being moved over.

Step 3: Update configuration

Paste the following commands into a file (replacing the partition names with the ones pertaining to your server), chmod 755, and run:

for user in `cat user` ;  do

replace /home4/ /home3/ — /var/cpanel/userdata/$user/*
replace /home4/ /home3/ — /etc/proftpd/$user
replace /home4/$user /home3/$user — /etc/passwd
ln -s /home4/$user /home3/$user
replace /home4/$user /home3/$user — /home3/$user/etc/*/passwd

done

Now, run:

/scripts/rebuildhttpconf && service httpd restart

service pure-ftpd restart (or proftp)

When you’re sure that everything is moved over, you can remove all the user data from the old partition.

Changing The Default Web Templates for cPanel

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

0

cPanel currently has four templates that are visible to your users:

Default website: Appears to visitors who navigate to a site that points to the server but isn’t configured in Apache
Account move: Appears to visitors who navigate to a site that has moved
Connection selection: Appears to visitors who navigate to a site that is experiencing a connection or firewall problem
Account suspended: Appears to visitors who navigate to a site that has been suspended

You can modify the templates in WHM > Web Template Editor, but what if you have multiple servers you need to update templates for?

The templates are stored in a simple location:

/var/cpanel/webtemplates/$user/$language/$templatename.tmpl

$user : The reseller user (all accounts under this reseller will use its templates)

$language: The language in use for cPanel

$templatename: The name of the template, with .tmpl appended:

Default website: default.tmpl
Account move: moving.tmpl
Connection selection: redirect.tmpl
Account suspended: suspended.tmpl

This way, if you wanted to (for example) change all the suspended pages for accounts owned by root, simply drop your html code into the following file:

/var/cpanel/webtemplates/root/english/suspended.tmpl

The way cPanel works in regards to these templates, is to redirect all sites matching relevant situations (such as suspended websites) to a compiled CGI file in /usr/local/cpanel/cgi-sys:

movingpage.cgi
defaultwebpage.cgi
suspendedpage.cgi
redirect.cgi

The files load up the template and serve them to the visitor reaching the website or cPanel for the account in question.

cPanel 11.25 Cheat Sheet

Posted by Vanessa | Tagged under: | Posted on July 2, 2010

5

We’ve developed our first cPanel 11.25 cheat sheet, now available for your downloading pleasure.  The sheet is comprised of common file, script, and configuration locations for help at a quick glance.

http://www.thecpaneladmin.com/wp-content/plugins/downloads-manager/img/icons/pdf.gif File: cPanel 11.25 Cheat Sheet (31.99KB)
Added: 07/02/2010
Downloads: 338
Description: cPanel ports, file/folder locations, scripts, and log locations

More cheat sheets will be available soon! Check back on our Cheat Sheets page for more.

How to Rebuild cPanel Bandwidth Graphs

Posted by Vanessa | Tagged under: | Posted on July 1, 2010

0

Cpanel 11.25 restructured the way that bandwidth RRD files are being processed, in that each service has two RRD files – one for peak, and one for rate.  The “peak” file is used for long timespans of a month or longer, and the “rate” file covers a timespan of a week or less.  The following is an example of files that would be created for domain.com:

domain
domain.com.5min
domain.com.hour
domain.com
domain.com.5min
domain.com.hour

Re rebuild the RRD databases for a user, run:

/usr/local/cpanel/bin/rebuildbwrrd <user>

To do this for the entire server:

/usr/local/cpanel/bin/rebuildbwrrd –all

Beware though that cPanel 11.25 requires a  bit more disk space for the new bandwidth graphs, so if you have /var on a separate partition and there won’t be enough room, I recommend doing the following:

mv /var/cpanel/bandwidth /home

ln -s /home/bandwidth /var/cpanel/bandwidth

You’re basically moving the bandwidth graphs to another location and linking them to /var/cpanel/bandwidth.