Archive for October, 2009

How to Enlarge /tmp on cPanel Servers

October 31st, 2009

If you don’t have a separate /tmp partition defined, you’re likely using cPanel’s tmpDSK method of setting up /tmp. By default, this “partition” is 512M in size, and for many that’s enough, but others need a larger /tmp.

So first, let’s edit /scripts/securetmp, and modify $tmpdsksize to increase the number of bytes this partition should have.
securetmp
Once you’ve set the value for $tmpdsksize, save the file, and let’s see what processes are using /tmp.

lsof /tmp

Likely, you’ll see a few MySQL and Apache processes. Now we’ll stop these processes (and any others using /tmp) so that we can unmount it.

service httpd stop
service mysql stop

Then umount /tmp and /var/tmp:

umount -l /tmp
umount -l /var/tmp

Then remove the old tmpDSK:

rm -fv /usr/tmpDSK

Then create your new /tmp:

/scripts/securetmp
Share

How to Enable and Repair Quotas in cPanel

October 31st, 2009

Quotas can be kind of a pain sometimes. If your accounts are showing 0 disk space used, be sure that you have enabled quotas in cPanel. Most people select this option during the initial cPanel configuration, but you can always enabled them later in WHM -> Initial Quota Setup. Once you’ve done that, let’s ensure that quotas are enabled on your partitions. You really only need them enabled on /home and /var. If you have a single partition, enable them on /.

fstab

If you needed to add usrquota to your /home partition, save your changes in /etc/fstab, and remount /home with

mount -o remount /home

Now we can run the following to repair the quotas:

/scripts/fixquotas

There are still plenty more ways that quotas can break, and dozens of errors associated with broken quotas, which I hope to go into deeper in the future.

Share

How to Disable DNS Recursion in Bind

October 31st, 2009

Disabling DNS recursion is something most administrators will suggest, as having it enabled can cause performance issues.

vi /etc/named.conf

Then, in the options { section, add the following:

recursion no;

If recursion yes; is already there, just change it to recursion no; and restart named to activate your changes.

./scripts/restartsrv_named
Share

How to Install Logwatch

October 31st, 2009

Logwatch is very simple to install on CentOS boxen:

yum -y install logwatch

This will install logwatch and configure the daily logwatch cron in /etc/cron.daily. If you want to customize your logwatch configuration, you can edit /etc/logwatch/conf/logwatch.conf and modify settings like the email address the report is sent to, the verbosity of the report, what day you want logwatch to process, etc. A sample configuration is located at /usr/share/logwatch/default.conf/logwatch.conf

Share

Install SSH2 for PHP

October 16th, 2009
wget http://downloads.sourceforge.net/project/libssh2/libssh2-1.2.1.tar.gz?use_mirror=softlayer
 tar -zxvf libssh2-0.12.tar.gz
 cd libssh2-0.12
./configure && make all install

Run the pear installer for PECL/ssh2:

pear install ssh2

If this installing via pear fails,

wget http://pecl.php.net/get/ssh2-0.11.0.tgz
 tar -zxvf ssh2-0.11.tgz
 cd ssh2-0.11
 phpize && ./configure --with-ssh2 && make

Copy ssh2.so to /usr/local/lib/php/extensions/no-debug-non-zts-20020429.

 cp modules/ssh2.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429

Add extension=ssh2.so to /usr/lib/php.ini
Run service restart httpd to enable these changes.

Share

Enable Logging of Slow MySQL Queries

October 10th, 2009

MySQL has a feature that allows you to log slow running queries to a file. To enable you just need to add some lines to your my.cnf file, and restart.

Insert the following into /etc/my.cnf:

log-slow-queries = /var/log/mysql/mysql-slow.log
long_query_time = 5

Save my.cnf and do the following when you return to a shell:

#touch /var/log/mysql/mysql-slow.log
#chown mysql:mysql /var/log/mysql/mysql-slow.log
#service mysql restart

Share

FAILED LOGIN webmaild: user password hash is missing from system (user probably does not exist

October 4th, 2009

From http://forums.cpanel.net/f43/account-based-email-login-problem-97109.html

root@servername [/home]# authtest -s imap test@normaldomain.info password
Authentication succeeded.

Authenticated: test@normaldomain.info (system username: normaldo)
Home Directory: /home/normaldo/mail/normaldomain.info/test
Maildir: /home/normaldo/mail/normaldomain.info/test
Quota: 262144000S
Encrypted Password: $1$KHntyoqN$wih5o0N7ZTf6Fm4vasrxj.
Cleartext Password: password
Options: (none)

FOR MY PROBLEMATIC DOMAIN:::

root@servername [/home]# authtest -s imap info@problemdomain.info password
Authentication FAILED: Operation not permitted

What you want to do next is check /usr/local/cpanel/logs/login_log to see what the exact issue is. In my circumstance, I received this error:

208.74.121.102 - info@jurnamakelaars.nl [10/04/2009:14:37:11 -0000] "POST /login/ HTTP/1.1" FAILED LOGIN webmaild: user password hash is missing from system (user probably does not exist)

I then checked the user’s shadow file in /home/USERNAME/etc/domain.com/shadow and saw that it was corrupt. I removed the file, created a new one, and applied user:mail permissions. I then created a new email account, then copied the user’s encrypted password after making entries in shadow for the existing users. I was then able to login to each webmail account without issue.

Share

Webmail logins failing

October 1st, 2009

First thing — check /usr/local/cpanel/logs/login_log

If you see a line like:

208.74.121.102 - name@domain.com [10/01/2009:17:21:12 -0000] "POST
/login/ HTTP/1.1" FAILED LOGIN webmaild: user password hash is missing
from system (user probably does not exist)

Check /home/USER/etc/DOMAIN/shadow to make sure that the webmail user is listed there. If not, copy one of the lines, change the username, and reset the password via cPanel.

Share

cPanel Web Site Hosting by IntraHost