Backup all cPanel accounts (then restore them) from ssh as root

To backup all accounts at once use the following command: for backup in `\ls /var/cpanel/users/`; do echo /scripts/pkgacct $backup; done   Afterwards download the backup files created (they will begin with cpmove- and be in the /home directory) To restore the backups upload the files under /home on the server then run the following also while within the /home directory: for backup in `ls |grep cpmove- | cut -d- -f2…

Correct the permissions of /home on a cPanel server

Handy script to correct the permissions of /home on a cPanel server: echo -e “Checking ownership of /home/user \n” for i in `ls /var/cpanel/users/` do if [ “$i” != “root” ]; then chown -R $i:$i /home/$i chown $i:nobody /home/$i/public_html /home/$i/.htpasswds chown $i:mail /home/$i/etc /home/$i/etc/*/shadow /home/$i/etc/*/passwd echo $i fi done Credit goes to http://dropdeaddick.com/2011/cpanel-fix-ownership-of-homeuser/

WHM has detected a manual hostname change.

If you received an email that contained the following: The system detected an invalid hostname configuration on: XXXXXXXXX The main IP address of your cPanel & WHM server is “XXX.XXX.XXX.XXX”. The hostname does not resolve to this IP address. This misconfiguration can cause some services on your server to fail to restart properly. The cause of your misconfiguration is: WHM has detected a manual hostname change. First make sure the…

Trim the eximstats database (cPanel)

If you’re using cPanel and have noticed you have a large eximstats database, you can clear it using one of these two methods: Method one: use eximstats; delete from sends; delete from smtp; delete from failures; delete from defers;   Method two: mysqladmin drop eximstats mysqladmin create eximstats mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

Disable cPHulk from the shell

If you’ve ever found yourself blocked by cphulk (typically this occurs because there have been too many failed logins by username or IP) and are still able to access the system the following will disable cphulk: /usr/local/cpanel/etc/init/stopcphulkd /usr/local/cpanel/bin/cphulk_pam_ctl –disable   another method is to clear the cphulk database (please note this will remove ALL current blocked usernames and IP addresses so I do not recommend it): mysql -u root use cphulkd;…

cPanel webmail woes

If you’re having issues with any webmail application that is included with cPanel have no fear! Just run the following command from ssh or a command line terminal as root or escalated user: For Roundcube /usr/local/cpanel/bin/update-roundcube –force For Horde /usr/local/cpanel/bin/update-horde –force For SquirrelMail /usr/local/cpanel/bin/update-squirrelmail –force   that will fix most issues, including with the databases themselves.