Friday, March 14, 2008

How do I disable the traceroute utility for users with shell access on my CPanel server?

Click on the "Tweak Security" link under "Security". In the right frameof your browser, will be a section called Traceroute Tweak.

Click on the "Configure" link for this section, to go to the next page,and then click "Disable".

How do I recover(undelete) a file I have accidentally removed on my Linux server?

The only recommended way to recover files that have been deleted, will be torestore from your most recent backup. Unfortunately, the default file systemfor most new linux installs(ext3), does not lend itself to easily undeleting files.

This is what one of the developers of ext3, Andreas Dilger, said about it:

In order to ensure that ext3 can safely resume an unlink after a crash, it actuallyzeros out the block pointers in the inode, whereas ext2 just marks these blocks asunused in the block bitmaps and marks the inode as "deleted" and leaves the block pointers alone.

Your only hope is to "grep" for parts of your files that have been deleted and hope for the best.

How can I manually kill the exim queue?

/usr/local/cpanel/whostmgr/bin/whostmgr2 killeximq

How can I limit the number of times a user can check a pop3 mailbox per hour?

Click on the "Tweak Settings" link under "Server Setup". Within the "Mail" section is a text box with the heading:

"The number of times users are allowed to check their mail using pop3 per hour:"

Change the value and apply the changes by clicking on the "Save" button at the bottom of the page.

How can I prevent users from bypassing the mail server to send mail?

Click the "Tweak Security" link under "Security". Click on the configure link under "SMTP Tweak" Check the box next to "Allow connections to localhost on port 25." and click apply. This will only allow the MTA (mail transport agent), mailman, and root to connect to remote SMTP servers.

How can I manually move a cPanel account to a new server?

When an account is too large to feasibly move using the web browser, I do the following to move the account :

The setup :
Domain : domain.com
Username : dom

make a temp directory on /home (i'll call it /home/cptemp/) where you can store the accounts files while copying.
#mkdir /home/cptemp
Almost all space for an account is in their public_html directory, so we'll want to tar and gzip it and move that over using scp.

#cd /home/dom/
#tar czvf public_html_dom.tgz public_html
#mv public_html_dom.tgz /home/cptemp/
#mv public_html /home/cptemp/

Also often times large sites have large weblogs, which are packaged and transfered, so we take care of those as well :

#cd /usr/local/apache/domlogs/
#gzip domain.com
#mv domain.com.gz /home/cptemp/

Now with these files in /home/cptemp/ , try moving the account over in WHM, hopefully it will succeed and set up the new account on the new server. Now we go back to /home/cptemp/ and scp the files to their new home.

#scp public_html_dom.tgz root@newserver.com:/home/dom/
(enter the root pass for the new server and let it copy the file over)
#scp domain.com.gz root@newserver.com:/usr/local/apache/domlogs/
(do the same as above)

Now go to the new server and unpack the two large files you just moved.

#cd /home/dom/
#tar xzvf public_html_dom.tgz
#cd /usr/local/apache/domlogs/
#gzip -d domain.com.gz

That's it ....

How can I mitigate pop3 connection floods?

Click on the "Tweak Settings" link under "Server Setup". Within the "Mail" section is a check box with the heading:
"Attempt to prevent pop3 connection floods"
Tick the check box and apply the changes by clicking on the "Save" button at the bottom of the page.