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

Skipping the WHM Setup Wizard on New Servers

Posted by Vanessa | Posted in Misc | 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 | Posted in Misc | 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 | Posted in Misc | 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.

Performance Tip: Disable Optimizefs

Posted by Vanessa | Posted in Misc | Posted on June 22, 2010

1

CPanel utilizes a script called “optimizefs” that removes the atime attribute from certain files on the system. For larger servers, this can create a lot of i/o load for a problem that can be fixed simply by mounting your file systems with the noatime flag if your file system is ext2 or higher.

The atime attribute is used by Linux to mark when a file was last accessed, and is understood to be a resource drain when enabled for an entire filesystem.  cPanel attempts to address this by removing atime attributes from a specific list of files.  You may see a command like this in your root crontab:

45 */8 * * * /usr/bin/test -x /usr/local/cpanel/bin/optimizefs && /usr/local/cpanel/bin/optimizefs

This cron basically applies the following command to a number of files and directories:

chattr +A /path/to/file/or/directory

Instead of using cPanel’s band-aid fix, it’s preferred to remove the atime attribute from the filesystem altogether. To do this, add noatime to the file system properties for each usable partition listed in /etc/fstab. For example:

LABEL=/ /  ext3    defaults,usrquota,noatime 0 0
/tmp /var/tmp ext3    defaults,usrquota,bind,noauto,noatime 0 0

Then remount each file system. For the example above using the root partition ( / ):

mount -o remount /

*In some cases, a reboot may be necessary

Now, you can remove the cron job and still get the same benefits of not having your operating system record file access times:

sed ‘/optimizefs/d’ -i /var/spool/cron/root && service crond reload

Additional Resources:

http://www.faqs.org/docs/securing/chap6sec73.html

Tips to Reduce Your Customer Support Costs

Posted by Mark | Posted in Misc | Posted on June 21, 2010

0

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 help.  Customer support is one of the highest expenses that a web host can encounter.  Just my making a few small changes, you can reduce the amount of customers that contact you for help, and increase your profit margin.

Revamp your “Welcome” documentation

The welcome documentation is usually an email that is sent to a new client containing server and account access information. It’s important to cover your bases to avoid ending up with confused users that have no other avenue but to ask you for help – something that tends to be frustrating for a new user.  Your welcome email should not be wordy, but rather bulleted and easy to read, and separated into sections.  It should contain any information your users needs to access their account and server, steps to get started, and how to find help.

Use video tutorials

Sites like Demo Demo provide flash tutorials for common control panel software, that can be branded to your company and used in your support center. Making it known to your customers that flash tutorials are available to explain the procedures for common tasks may prevent them from contacting you.

Establish a knowledge base

A knowledge base is generally used by hosting providers to provide information to address common questions and problems encountered by customers.  If you’re seeing a common question being risen by your users, consider making the answer to that question more visible by adding it to a knowledge base full of FAQs, or adding it to your welcome documentation.

Don’t do anything that provokes a response

It should be expected that changes and upgrades will need to take place during the life of a user’s account.  However, unless you’ve planned for the worse, don’t make changes that your customers will notice and likely contact you about unless you’ve notified them first.  If you’re making a change that may affect users, make sure your users know how the change can affect them and what steps to take if they have a problem.  It’s not recommended to play fast and loose with items that will attract user attention in a negative light, so plan your upgrades and changes accordingly.

Be open

Set up a blog or status site that your customers will know to check if they are experiencing a problem.  For example, Dreamhost has a website their customers can access to find out about outages or problems, thus preventing them from contacting the customer support center to find out what’s going on.  Customers tend to appreciate more transparency  when it comes to problems that can affect their site.

Test, test, test

It should go without saying that you should not deploy changes on your hosting servers without thoroughly testing them first.

Keep an eye out

If you are not monitoring your network, you’re a step behind from even the worst of the hosting providers out there.  You should be monitoring anything that could cause an interruption in service, as your customers should not know about downtime before you do.  Knowing when a problem will happen before it does will easily prevent  problems that can result in thousands of dollars in losses and customer support costs.

Be responsive

If you see a problem that is continually affecting multiple clients, do something about it.  Sites getting hacked? Consider implementing a solution to block the attacks and issuing an advisor so your customers know you are looking out for them.  Hosting servers are in constant need of maintenance to make sure they are running quickly and securely.

Get it right the first time

Anyone that manages a support center will know that each response, phone call, chat, and email costs money.  Addressing your customers’ requests and problems correctly and thoroughly the first time will limit your follow ups.

10 Free Monitoring Solutions to Consider

Posted by Vanessa | Posted in Misc | Posted on January 17, 2010

1

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 of time setting up monitoring for your server. We’ve compiled a list of free monitoring solutions you can use to guarantee minimal downtime for your users, and show customers how reliable your service is!

11 Ways to Free Up Disk Space on a cPanel Server

Posted by Vanessa | Posted in Misc | Posted on January 16, 2010

4

I’m sure that most of you have been to the point where one or more of your servers start to fill up as you get more customers. The server’s performing just fine, but there’s one problem…you’re out of disk space! Here are a few simple tricks to freeing up disk space on your cPanel server to help maximize your server’s potential.

1) Delete user cPanel and Fantastsico backups

If you have the backup feature in cPanel enabled, chances are your users are storing the backups on the server instead of downloading and removing them. On larger servers, this can account for a lot of disk space usage. You may want to consider warning your users ahead of time that backups will automatically be removed from the server after a certain period of time or on certain dates.  You can mass-delete all user cPanel backups on the server with this command:

for user in `/bin/ls -A /var/cpanel/users` ; do rm -fv /home/$user/backup-*$user.tar.gz ; done

To remove Fantastico backups:

rm -rfv /home/*/fantastico_backups

2) Move your backups offsite

Similarly to above, if you’re using the cPanel Backup System and are storing your backups locally on the server, you could be using twice as much space as you need to. Consider mounting a backup server to your hosting server and storing the backups there (there is an option to mount external media in WHM > Configure Backups) or using an alternate method of backing up your server that doesn’t involve storing the backups locally. While local backups may be convenient at times, they tend to be useless when a server failure occurs.

3) Delete cPanel File Manager temp files

When users upload files in File Manager within cPanel, File Manager creates a temp file that may or may not get removed upon upload. You can remove these files using this command:

rm -fv /home/*/tmp/Cpanel_*

4) Move or archive logs

Most of the server’s logs are stored in /var/log, which can get rather large on more populated servers. You can change the length of time and frequency of the log rotation in /etc/logrotate.conf, and enable compression to save additional space (at the expense of CPU when the logs are being gzipped). If you want older logs, consider creating a cron job to periodically transfer them to a backup or log server so they aren’t taking up space on your hosting server.

5) Remove cPanel update archives

Cpanel and EasyApache updates tend to leave behind files that you probably don’t need. The following can be deleted or moved to a backup server to free up a little bit of space:

/usr/local/apache.backup*

/home/cpeasyapache (actual name may vary depending on cpanel version)

6) Clean up Yum files

Yum updates leave package cache files on the server. You can clean up all unneeded yum files by running:

yum clean all

7) Remove pure-ftp partials

When your users upload files to the server via FTP when your server runs pureFTP as an FTP daemon, the FTP server creates temporary files starting with .pureftpd-upload* that get renamed the the actual filename when the upload completes. If the upload doesn’t complete, these files are left on the server. You can find and delete these by running:

locate .pureftpd-upload | xargs rm -fv

*If you don’t run an updatedb regularly, you might want to do so before running this command

8) Decrease the reserved disk space

By default, Linux reserves 5% of the disk space from each partition for the root user, so root can still log in even if the disk is full. You may have noticed when running a df that you may be using 900GB out of a 1TB drive, but only have 50GB available…that’s because the other 50GB is reserved.

For larger drives, you really don’t need the whole 5%. I would recommend setting this value down to 2500 blocks so you can utilize more of the disk space. You can do this with tune2fs:

tune2fs -r 2500 /dev/sda1

You’ll want to probably man the tune2fs command before you use it for other options on setting the reserved space for your partitions.

9) Remove unneeded accounts

If you have a larger churn rate you probably have some user accounts laying around on your server that you don’t need. Check out WHM > List Suspended Accounts (or ls /var/cpanel/suspended) and look for suspended accounts that you may be able to remove from the server to free up space. You can terminate accounts in WHM > Terminate an Account or using the command /scripts/killacct <user> <y/n> (y/n indicating whether to save the DNS records)

10) Check for contrabands

As a hosting provider you should have a Terms of Service that specifically tells your customers what they can (or rather cannot) store on your server. Most hosts have specific rules about the hosting of non-website-related backups and copyrighted material, but don’t pro actively scan their servers for it.  It wouldn’t hurt to run a few locate commands to find common files associated with copyright violations, like .mp3, .avi, .exe, etc, and have your customers remove them from the server. I once cleared over 300Gb of space on a server just by having customers remove contraband files from the server. On top of that, you’re also preserving the integrity of your business from a legal standpoint.

11) Consider a larger server

Some of your customers may have a legitimate need for large amount of disk space, and therefore you may be unable to keep the disk space usage on your server at a reasonable level. A lot of hosting providers have alternate servers that are more “low key” but have huge disk storage volumes to accommodate customers that have larger sites. You might want to consider investing in a server that will be less populated and only the users that occupy a large amount of space.