Wednesday, July 15, 2009

click be installation

mkdir -p /var/netenberg/click_be/installer/
cd /var/netenberg/click_be/
wget http://www.netenberg.com/files/click_be/free/click_be_installer.bz2
tar -xjpf click_be_installer.bz2
cd /var/netenberg/click_be/installer/
php click_be.php status
php click_be.php install

rvskin installation

mkdir /root/rvadmin
cd /root/rvadmin
wget http://member.rvskin.com/auto_rvskin.tgz; tar -xvzf auto_rvskin.tgz perl auto_rvskin.pl

Thursday, July 9, 2009

Fantastico problems

Fantastico is not installed at the default location
/usr/local/cpanel/3rdparty/fantastico. Either move the
Fantastico directory from it's current location to
/usr/local/cpanel/3rdparty/fantastico OR enable
ioncube loaders in WHM -> Tweak settings.

To print a-z

for i in {a..z} ; do echo $i;done;

Unable to upload files via cpanel file manager

solution:

go to whm>manage plugins> install clamav

this will fix the issue

To grep multiple contents

egrep "foldername|foldername|foldername"

How to install RPM

How to install RPM
What is RPM?



Many Linux distributions use RPM as the default application management system. This means that when using RPM packages, it is quite easy to install applications to your favorite Linux distributions.

RPM is originally developed by Red Hat, but nowadays you can run into rpm in many other linux distributions (for example Fedora Core, CentOS, Mandriva or Yellow Dog Linux) and even on other operating systems (Novel Netware and IBM Aix).

RPM packaged software follows usually the following format:

(name)-(version)-(release).(arch).rpm

For example: httpd-2.23-2.i386.rpm

Also source codes can be downloaded in rpm packages. For example httpd-2.23-2.i386.src.rpm. RPM files with the noarch.rpm extension refer to files that don't depend on a computer's architecture.

Install RPM

Installing RPM package is very easy and straightforward:

* rpm -ivh package.rpm - installs package.rpm
* rpm -Uvh package.rpm - updates package.rpm
* rpm -qi package - displays (already installed ) information about application "package"
* rpm -qpi package.rpm - displays information about rpm-file
* rpm -qpl package.rpm - displays files included in package.rpm
* rpm -qa - lists all rpm packages installed to your distribution
* rpm --rebuilddb - rebuilds your rpm database

With these simple commands you can install rpm packages to your linux distribution!

Data base restore from old to new

1. Check whether the PHP and Apache configurations of /old and the new server.
/old/var/cpanel/cpanel.conf
/old/usr/local/apache/conf/
2. Recompile PHP and Apache to make so.
3. Run the script http://script.sherin.co.in/cpanel/restorefiles.sh
4. Copy the content in /old/var/lib/mysql to /var/lib mysql/ ---- (with same permisions and ownerships)
5. Copy the content of /old/home/ to /home/ ---- (with same permisions and ownerships)
6. Again run an upcp and recompile Apache and PHP.

Wednesday, July 8, 2009

disable open_base and safe_mode

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/brightla/public_html/directions.php on line 190


solution

1. log into his WHM and click Security Center under the Security section.
2.The 5th option down should be PHP open_basedir Tweak
3.From there you can disable it per account

Argument list too long

Argument list too long

Have you ever seen this very annoying error message? I bet you have!

I had to move little over 36k files in one directory to another box. Scp and both let me know there's too many files for them to handle. So what to do?

Each shell session has a pre-configured amount of storage with a hard limit. To check it you can type getconf ARG_MAX which will type whatever the max arg is in your box.

You can work around this easily wit tar. Just pre-build list of filenames and then pass the list to tar:


find . -iname '*.gif' > list.txt
tar czvf files.tar.gz --files-from list.txt


Sit back and enjoy the ride while box archives your files!

Monday, July 6, 2009

database repair

mysqldump: Got error: 145: Table './epidata_tikidb/tiki_searchindex' is
marked as crashed and should be repaired when using LOCK TABLES

solution:

myisamchk -crS /var/lib/mysql/database/*.MYI

Thursday, July 2, 2009

HOW TO PREVENT DDOS ATTACKS

All web servers been connected to the Internet subjected to DoS (Denial of Service) or DDoS (Distrubuted Denial of Service) attacks in some kind or another, where hackers or attackers launch large amount connections consistently and persistently to the server, and in advanced stage, distributed from multiple IP addresses or sources, in the hope to bring down the server or use up all network bandwidth and system resources to deny web pages serving or website not responding to legitimate visitors.

You can detect the ddos using the following command

netstat -anp|grep tcp|awk '{print $5}'| cut -d : -f1|sort|uniq -c|sort -n

It will shows the number of connections from all IPs to the server.

There are plenty of ways to prevent, stop, fight and kill off DDoS attack, such as using firewall. A low cost, and probably free method is by using software based firewall or filtering service. (D)DoS-Deflate is a free open source Unix/Linux script by MediaLayer that automatically mitigate (D)DoS attacks. It claims to be the best, free, open source solution to protect servers against some of the most excruciating DDoS attacks.

(D)DoS-Deflate script basically monitors and tracks the IP addresses are sending and establishing large amount of TCP network connections such as mass emailing, DoS pings, HTTP requests) by using “netstat” command, which is the symptom of a denial of service attack. When it detects number of connections from a single node that exceeds certain preset limit, the script will automatically uses APF or IPTABLES to ban and block the IPs. Depending on the configuration, the banned IP addresses would be unbanned using APF or IPTABLES (only works on APF v 0.96 or better).

Installation and setup of (D)DOS-Deflate on the server is extremely easy. Simply login as root by open SSH secure shell access to the server, and run the the following commands one by one:

wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh

To uninstall the (D)DOS-Deflate, run the following commands one by one instead:

wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos

The configuration file for (D)DOS-Deflate is ddos.conf, and by default it will have the following values:

FREQ=1
NO_OF_CONNECTIONS=50
APF_BAN=1
KILL=1
EMAIL_TO=”root”
BAN_PERIOD=600

Users can change any of these settings to suit the different need or usage pattern of different servers. It’s also possible to whitelist and permanently unblock (never ban) IP addresses by listing them in /usr/local/ddos/ignore.ip.list file. If you plan to execute and run the script interactively, users can set KILL=0 so that any bad IPs detected are not banned

DIG COMMAND

DIG Command
dig is a command-line tool for querying DNS name servers for information about host addresses, mail exchanges, name servers, and related information.
Understanding the default output

The most typical, simplest query is for a single host. By default, however, dig is pretty verbose. You probably don’t need all the information in the default output, but it’s probably worth knowing what it is. Below is an annotated query.

This article explains you how to do the data recovery from a crashed windows-plesk server.

$ dig www.yahoo.com

That’s the command-line invocation of dig I used

; <<>> DiG 9.2.3 <<>> www.yahoo.com
;; global options: printcmd

The opening section of dig’s output tells us a little about itself (version 9.2.3) and the global options that are set (in this case, printcmd). This part of the output can be quelled by using the +nocmd option, but only if it’s the very first argument on the command line (even preceeding the host you’re querying).

;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43071
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

Here, dig tells us some technical details about the answer received from the DNS server. This section of the output can be toggled using the +[no]comments option—but beware that disabling the comments also turns off many section headers.

;; QUESTION SECTION:
;www.yahoo.com. IN A

In the question section, dig reminds us of our query. The default query is for an Internet address (A). You can turn this output on or off using the +[no]question option.

;; ANSWER SECTION:
www.yahoo.com. 600 IN A 203.23.184.88

Finally, we get our answer: the address of www.yahoo.com is 204.152.184.88. I don’t know why you’d ever want to turn off the answer, but you can toggle this section of the output using the +[no]answer option.

;; AUTHORITY SECTION:
yahoo.com. 2351 IN NS ns1.nis.tc.org.
yahoo.com. 2351 IN NS ns1.gnac.com.
yahoo.com. 2351 IN NS ns2.nis.tc.org.

The authority section tells us what DNS servers can provide an authoritative answer to our query. In this example, yahoo.com has three name servers. You can toggle this section of the output using the +[no]authority option.

;; ADDITIONAL SECTION:
ns1.gnac.com. 171551 IN A 203.23.34.21
ns-int.yahoo.com. 2351 IN A 211.52.18.65
ns-int.yahoo.com. 2351 IN AAAA 2001:4f8:0:2::15

The final section of the default output contains statistics about the query; it can be toggled with the +[no]stats option.
Some useful options with dig

dig will let you perform any valid DNS query, the most common of which are A (the IP address), TXT (text annotations), MX (mail exchanges), NS name servers, or the omnibus ANY.
# get the address(es) for yahoo.com

dig yahoo.com A +noall +answer

# get a list of yahoo's mail servers

dig yahoo.com MX +noall +answer

# get a list of DNS servers authoritative for yahoo.com

dig yahoo.com NS +noall +answer

# get all of the above

dig yahoo.com ANY +noall +answer

#Short answer

dig yahoo.com +short

#To get the TTL values

dig +nocmd yahoo.com mx +noall +short

#To get a long answer

dig +nocmd yahoo.com any +multiline +noall +answer

#To reverselookup

dig -x 216.109.112.135 +short

To bulk lookups # do full lookups for a number of hostnames

#dig -f /path/to/host-list.txt

#the same, with more focused output

dig -f /path/to/host-list.txt +noall +answer

Tracing dig's path

dig yahoo.com +trace

How to interpret TTL value

If you ask your local DNS server for an Internet address, the server figures out where to find an authoritative answer and then asks for it. Once the server receives an answer, it will keep the answer in a local cache so that if you ask for the same address again a short time later, it can give you the answer quickly rather than searching the Internet for it all over again.

When domain administrators configure their DNS records, they decide how long the records should remain in remote caches. This is the TTL number (usually expressed in number of seconds).

When domain administrators configure their DNS records, they decide how long the records should remain in remote caches. This is the TTL number (usually expressed in number of seconds).
For example, as of this writing, the TTL for the MX records for the gmail.com domain is 300 seconds. The gmail.com admins are asking that remote servers cache their MX records for no more than five minutes. So when you first ask for that record set, dig will report a TTL of 300.

$ dig +nocmd gmail.com MX +noall +answer
gmail.com. 300 IN MX 20 gsmtp57.google.com.
gmail.com. 300 IN MX 10 gsmtp171.google.com.

If you ask a few seconds later, you’ll see the TTL number reduced by approximately the number of seconds you waited to ask again.

$ dig +nocmd gmail.com MX +noall +answer
gmail.com. 280 IN MX 10 gsmtp171.google.com.
gmail.com. 280 IN MX 20 gsmtp57.google.com.

If your timing is good, you can catch the record at the very end of its life.

$ dig +nocmd gmail.com MX +noall +answer
gmail.com. 1 IN MX 10 gsmtp171.google.com.
gmail.com. 1 IN MX 20 gsmtp57.google.com.

After that, the DNS server you’re querying will “forget" the answer to that question, so the whole cycle will start over again (in this example, at 300 seconds) the next time you perform that query.

INSTALL A PEAR MODULE MAIL.php

For installing Mail.php module

pear install mail

we can verify it from the following command

pear list

DOMAIN NAME IS NOT LISTING IN THE WHM * LIST ACCOUNTS

Please make sure that the domain entry in the following files.

/etc/userdomains

(domain name and username should be present in this file)

/etc/localdomains

/etc/trueuserdomains

CPANEL INSTALLATION

cPanel Installation Instructions:
cPanel now uses a universal install script which can be found at
http://layer1.cpanel.net/. You can use the following commands in the root
shell to download and start the installation script:
mkdir /home/cpins
cd /home/cpins
wget http://layer1.cpanel.net/latest
sh latest

EACCELERATOR INSTALLATION

Eaccellerator Installation
Also another route is:

Code:

wget http://www.ecsportal.com/projects/eaccelerator.sh
chmod 755 eaccelerator.sh
./eaccelerator.sh



when done you see link look like

Code:

quote:/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so

copy your like to add in php.ini

edit php.ini
Code:

nano -w /usr/local/lib/php.ini

add this after Windows Extensions , in the list down.

Code:

zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20020429/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"



save and restart apache

Code:

/sbin/service httpd restart


*END*

test your work now

Code:

php -v


if your install done you will see look like this

Code:

> php -v
PHP 4.4.4 (cli) (built: Aug 23 2006 04:09:14)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.5-rc1, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v3.0.1, Copyright (c) 1998-2006, by Zend Technologies


This installation will work on DirectAdmin + CPanel Systems

IONCUBE INSTALLETION

Installing Ioncube
ionCube produces leading tools for PHP source code protection to secure your PHP software from prying eyes and to combat software piracy. Featuring an advanced compiled-code encoding engine that translates source to highly efficient bytecodes, ionCube encoding tools deliver the ideal combination of maximum source code protection without sacrificing performance, reliability or language compatibility.

In order to view encoded ionCube files on your server you need the ionCube loader. This is a free plugin for Apache web server that only takes a few minutes to install and is well worth it.
http://www.ioncube.com/

Requirements:
- Root Shell access to your server
- phpinfo page: create a new document and call it phpinfo.php. Inside place phpinfo();
Place this document in your www directory so you can view it and see all your PHP settings.


Installing ionCube Loader:

1. Download the program and store it on your server using wget or FTP.
http://www.ioncube.com/loader_download.php

2. Unpack the program
tar -zxvf ioncube_loaders.tar.gz

3. cd ioncube

4. copy ioncube-install-assistant.php to a web directory such as your hosting directory and open it in your browser window.
cp ioncube-install-assistant.php /home/userdirectoryhere/www

Then open it http://www.yourdomain.com/ioncube-install-assistant.php
The output should be something similar to:

Analysis of your system configuration shows:

PHP Version 4.3.3
Operating System Linux
Threaded PHP No
php.ini file /usr/local/lib/php.ini
Required Loader ioncube_loader_lin_4.3.so

5. Now lets move the iconcube directory to a permanent location:
cd ..
mv ioncube /usr/local

6. Now that you know the location of php.ini you need to edit it.
pico /usr/local/lib/php.ini

Now find where other zend extentions are in the file.
ctrl + w: zend_extension

Paste in your new line for ioncube loader
zend_extension = /usr/local/ioncube/ioncube_loader_lin_4.3.so

7. Save the changes
ctrl + X then Y and enter

8. Restart the web server to take effect.
/etc/init.d/httpd restart

Success! You should now see a section in your PHP Info page that says:
Additional Modules
Module Name ionCube Loader

Hide Commands in Shell

Hide Commands in Shell

To hide the commands you are entering in shell, use "stty" command :)

#stty -echo

Now, all commands that you type are invisible.
To disable this mode, issue the following command at the shell prompt:

#stty echo

Hows it? :)

Tuesday, June 30, 2009

To disable email seniding in cron tab

Add /dev/null 2>&1 at the end of the script

i.e 30 8 * * * command > /dev/null 2>&1

script to print 1-10

for i in `seq 1 10` ;do echo $i;done;

Sunday, June 21, 2009

DNS FORWARDING

for a in 'grep theright /etc/trueuserowners | cut -d ':' -f1'; do for b in `grep $a /etc/userdomains | cut -d":" -f1`;do replace "66.7.213.144" "66.7.219.239" -- /var/named/$b.db ; done ; done;

To change the Ip from 66.7.213.144 to 66.7.219.239

Thursday, June 18, 2009

Email forwarders

You can import email forwarders for one domain at a time ,i.e your list must be in the following form

For example you have 5 email address in the domain "nmjw02.com" i.e test1@nmjw02.com,...test5@nmjw02.com ,you can import the forwarders for these addresses in the following manner

source target
test1 jibin.t@hostdime.in
test2 rahul.r@hostdime.in
.
.

and lastly select the domain "nmjw02.com" from the drop down list. Other wise it will not work.

You can get the details regarding this issue From the following link

===================

http://tutorials.hostmonster.com/emailimport/

==================

If you need further assistance Please feel free to contact us.

Regards.

Wednesday, June 17, 2009

Installations

http://karthickv.wordpress.com/2008/06/

how to do transfer having account size more than 2 GB

1) Move public_html to /home/ as user_public or public_user (anything like that)
2) create a link of user_public to ../ (i.e /home)
3) packageaccount user_public
4) restore account user_public

then you need to transfer public_html by rsync

transfer user_public using rsync to /home of dest: and then it rename a public_html ...

Monday, June 15, 2009

How to secure a server....

We can easily done by this using the following script

=========

http://script.sherin.co.in/jsecure.sh

=========

Sunday, June 14, 2009

How can I change my MySQL database collation?

Usually you will be interested in changing your MySQL collation in order to solve problems with foreign character encodings. The most common case is to change your MySQL collation from latin1 to utf8. This can be done by using phpMyAdmin and following the instructions below:



1. Enter your cPanel and click on the phpMyAdmin icon in the Databases box.


2. Select the database you wish to manage from the drop-down menu on the left



3. Click on the Operations tab in the top menu of your phpMyAdmin



4. At the bottom of the page you will see the collation option. You can now select a collation from the drop down menu and click on the Go button.


Please note that after your change the collation of a database only the new tables will be created with the new collation. All other tables remain with the collation, they were initially created.



For the convenience of their customers, most web hosts have set MySQL's collation to utf8 by default. You can also benefit from this feature by joining Siteground.

How to change ssh informations

Changing the port number
vi /etc/ssh/sshd_config
edite the port number
restart the sshd------>>>/etc/init.d/sshd restart

Saturday, June 13, 2009

AWSTATS NOT UPDATING

go to

/home/user/tmp/awstats/awstats.domainname.conf

change

AllowToUpdateStatsFromBrowser 0 ===>>> 1

go to whm >> tweak settings >> under stats >> AllowToUpdateStatsFromBrowser

check the option

How to reset mysql password

mysql -u username -p

SET PASSWORD FOR cenimed_cardio@localhost = OLD_PASSWORD('123456');

grant all privileges on saudican_monpl2.* to 'saudican_monpl2'@'localhost' identified by 'monpl2';

Disable Modsecurity

Add the following into .htaccess

SecFilterEngine Off
SecFilterScanPOST Off

IT IS POSSIBLE TO DISABLE MOD_SECURITY UNDER PARTICULAR FOLDERS i.e add a .htaccess file under that folder and add the above two lines

To convert courier to dovcot

To convert courier to dovecot

==========
# /scripts/setupmailserver --force dovecot
# /scripts/convert2dovecot
=========

PS: Don't convert it is shared server until you get an update

convert mbox to maildir

In shared servers maildir is preferred .You can do the above same by using mail directory conversion system in the webhost manager.

To enable Wild card on domains

go to zone file

i.e /var/named/domain.conf

add
* IN A IP

restart apache

/scripts/restartsrv httpd

vi /usr/local/apache/conf/httpd.conf

server alias *.domainname

save and exit

restart httpd

Mysql error

[root@ibasoft ~]# service mysql restart
Shutting down MySQL/etc/init.d/mysql: line 220: kill: (7430) - No such process
................................... [FAILED]
rm: cannot remove `/var/lock/subsys/mysql': Read-only file system
Starting MySQL [ OK ]


=======

Check the hard disk by using

/scripts/smartcheck

SVN (subversion)

For future reference, to recompile the svn modules:
cd /root/downloads/subversion-1.6.2
make clean

./configure --with-apxs=/usr/local/apache/bin/apxs --with-apr=/home/cpeasyapache/src/httpd-/srclib/apr/apr-1-config --with-apr-util=/home/cpeasyapache/src/httpd-/srclib/apr-util/apu-1-config --prefix=/usr/local/subversion --with-sqlite=/usr/local/sqlite

make

make install

Friday, June 12, 2009

FAST CGIT OVER mod_wsg

FastCGI for PHP makes all your PHP applications run through mod_fastcgi instead of mod_phpsusexec. This eliminates the overhead of loading the PHP interpretor on every hit. Since it is always in memory ready for the next hit, the responses will be generated faster. This is done without a need to modify to your existing PHP applications will be performed so you can easily enable and disable it at will.
Please verify the following FastCGI Benefits:
================================
1.PHP scripts will run faster. The PHP interpreter is loaded into memory rather than calling from storage for every hit, greatly improving performance of your scripted site.
2.You will use less Server Resources. Since the server does not have load the PHP interpreter for each hit, you will be able to accommodate a higher traffic site without exceeding your CPU quota.
3. No modifications to your existing code are required. Everything you currently run will work with FastCGI for PHP.
===================================
Thus, FastCGI is better than mod_wsgi. Shall we procced with the FastCGI installation.

cannot create mailing list

ImportError: No module named paths
Unable to touch file /usr/local/cpanel/3rdparty/mailman/archives/public/index.html: No such file or directory at /usr/local/cpanel/bin/mailman-install line 188.
Processing consult

=========

yum install python-devel
/scripts/reinstallmailman

Thursday, June 11, 2009

Difference between du and df commands

We normally see issues where the "du" and "df" outputs different disk space usage.

A common scenario is filling up of /var partition due to log files.

We usually clear the logs and the "du" outputs the expected result whereas "df" still shows the earlier reading.

This is due to the fact that, some user processes keeps the deleted files open. "du" doesn't show that since the file (if it is removed), or the file contents (if it is cleared) is not there in the current working directory.


"df" will continue to display the previous disk space, until the space is de-allocated. To de-allocate this space either the file descriptor of the file should close or the process should exit.


Therefore you can try restarting the daemons used by these files or reboot the server.

Wednesday, June 10, 2009

maildirsize file

root@clara [~]# cat /home/jckmedia/mail/domain.com/username/maildirsize

Squirrelmail: [ALERT] You exceeded your mail quota

Squirrelmail webmail will sometimes throw the following error message when sending (or moving) an email:

ERROR: Could not append message to INBOX.Sent.
Server responded: [ALERT] You exceeded your mail quota.
Solution: Remove unneccessary messages from your folder and start with
your Trash folder.

Common sense would say to delete your trash. Well, that’s not going to work. The problem is that the “maildirsize” file in the user’s Maildir is not showing the correct quota information. Simply delete the file from the user’s Maildir and the problem will go away. When the user receives a new email, the file will be recreated with the correct information.

Important Links

http://mycutelife.net [Linux Related issues and fix]

http://forums.cpanel.net/ [cpanel forums]

http://kb.bobcares.com/ [Bobcares knowledge base]

http://www.scribd.com/doc/16236492/Linux-Commands [Linux Commands ]

http://junitham.blogspot.com/ [collection of problems and solutions]

http://tutorials.hostmonster.com/emailimport/ [video tutorial for importing email addresses and email forwarders]

http://kb.siteground.com/category/cPanel_common_questions_and_problems.html [common cpanel issues]

http://www.thelinuxblog.com/2007/08/ [linux experts]

http://niyaas.blogspot.com/2008/01/history-of-linux.html [linux guru]


http://www.rootglobal.com/ [linux scripting basics]

http://www.unixnewbie.org/

http://www.tldp.org/LDP/abs/html/ [bash guide]

http://www.nazeems.tk/

Outlook Express

Steps to configure Outlook express

1) Go to the Tools menu and select Accounts.
2) In the Internet Accounts window, click the Add button and select the Mail option.
3) Enter your name as you would like it to appear on your email in Display name: field.
4) Click the Next button.
5) Fill in E-mail address.
6) Click the Next button.
7) For Incoming mail (POP3, IMAP, or HTTP) server put your e-mail server(mail.DOMAIN.COM)
8) Click the Next button.
9) Enter the Account name: (test@DOMAIN.COM)
10) Enter the Password which corresponds to this account.
11) Do NOT select Log on using Secure Password Authentication (SPA).
12) Click the Next button.
13) Click the Finish button.
14) In the Internet Accounts window, click the Mail tab, then double-click your account name, this will open the properties window.
15) In the Account Properties window, click the Servers tab.
16) Under Outgoing Mail Server, check next to My server requires authentication.
17) Click the Advanced tab, disable the option Leave a copy of message in the server.
18)Then click apply and then Ok.

Script to change premission of files and folders

To change the permission of files to 644
find /home/$i/public_html -type f -exec chmod 644 '{}' \;

To change the permission of folders to 755
find /home/$i/public_html -type d -exec chmod 755 '{}' \;

Php Suexec

To check whether php suexec is enabled in the server

/usr/local/cpanel/bin/rebuild_phpconf --current

Block IP using IP tables

iptables -A INPUT -s IP -j DROP
iptables -A OUTPUT -d IP -j DROP

Php info page not showing changes??

1)Copy /usr/local/cpanel/cgi-sys/php5.cgi to /home/username/ public_html/cgi-bin

2)Add the below given script

root [/home/username/public_html/cgi-bin]# vi phpini.cgi
#!/bin/sh
export PHPRC=/home/username/public_html
exec /home/username/public_html/cgi-bin/php5.cgi

3)And added a php.ini in the location (/home/username/public_html)

4)In the .htaccess put the following.

AddHandler php-cgi .php
Action php-cgi /cgi-bin/phpini.cgi

5) Permission of phpini.cgi should be 755

To change Maximum emails perhour for a domain

1) Check [root@server ~]#vi /var/cpanel/maxemailsperhour to increase the value

2)[root@server ~]# vi /var/cpanel/maxemails
# If you update this file you must run /scripts/build_maxemails_config
domain.com=500
site.net=1000

3) To check the change
[root@server ~]#cat /var/cpanel/maxemailsperdomain/domain.com
500

To check whether ASP is avaliabe in server

/usr/local/apache/bin/httpd -l |grep mod_mono

Exim commands

1) To delete mails in the mail queue older than a day
exiqgrep -o 86400 -i | xargs exim -Mrm

2)exim -bp|grep $name Will show the mail in queue for $name
exim -Mvh $MSGID View message header
exim -Mvb $MSGID View message body
exim -M $MSGID Force delivery of message
exim -v -M $MSGID View the transact of message

3)Force delivery of one message
exim -M email-id

4)Force another queue run
exim -qf

5)Force another queue run and attempt to flush the frozen message
exim -qff

6)View the log for the message
exim -Mvl messageID

7)View the body of the message
exim -Mvb messageID

8)View the header of the message
exim -Mvh messageID

8)Remove message without sending any error message
exim -Mrm messageID

9)Giveup and fail message to bounce the message to the Sender
exim -Mg messageID

10)How much mail in the queue?
exim -bpr | grep "<" | wc -l


11)How many Frozen mails in the queue
exim -bpr | grep frozen | wc -l


12)Deleteing Frozen Messages
exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm


13)To find out, how many messages are there in the mail queue:
exim -bpc

14)To check the mails in the queue:
exim -bp

15)To force exim update:
/scripts/eximup --force

Number of connection to port 80 from different IP's

netstat -plan | grep :80 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

tmp showing 100% even after removing file!!!

root@server [/tmp]# lsof +aL1 /tmp | awk '{print $2}' | xargs kill -9

Cpanel Backend files!

Apache
=======
/usr/local/apache
+ bin- apache binaries are stored here - httpd, apachectl, apxs
+ conf - configuration files - httpd.conf
+ cgi-bin
+ domlogs - domain log files are stored here
+ htdocs
+ include - header files
+ libexec - shared object (.so) files are stored here - libphp4.so,mod_rewrite.so
+ logs - apache logs - access_log, error_log, suexec_log
+ man - apache manual pages
+ proxy -
+ icons -

Init Script :/etc/rc.d/init.d/httpd - apache start script
Cpanel script to restart apache - /scripts/restartsrv_httpd

Exim
=====
Conf : /etc/exim.conf - exim main configuration file
/etc/localdomains - list of domains allowed to relay mail
Log : /var/log/exim_mainlog - incoming/outgoing mails are logged here
/var/log/exim_rejectlog - exim rejected mails are reported here
/exim errors are logged here
Mail queue: /var/spool/exim/input
Cpanel script to restart exim - /scripts/restartsrv_exim
Email forwarders and catchall address file - /etc/valiases/domainname.com
Email filters file - /etc/vfilters/domainname.com
POP user authentication file - /home/username/etc/domainname/passwd
catchall inbox - /home/username/mail/inbox
POP user inbox - /home/username/mail/domainname/popusername/inbox
POP user spambox - /home/username/mail/domainname/popusername/spam
Program : /usr/sbin/exim (suid - -rwsr-xr-x 1 root root )
Init Script: /etc/rc.d/init.d/exim

ProFTPD
========
Program :/usr/sbin/proftpd
Init Script :/etc/rc.d/init.d/proftpd
Conf: /etc/proftpd.conf
Log: /var/log/messages, /var/log/xferlog
FTP accounts file - /etc/proftpd/username - all ftp accounts for the domain are listed here

Pure-FTPD
=========
Program : /usr/sbin/pure-ftpd
Init Script :/etc/rc.d/init.d/pure-ftpd
Conf: /etc/pure-ftpd.conf
Anonymous ftp document root - /etc/pure-ftpd/ip-address

Frontpage Extensions
=================
Program - (Install): /usr/local/frontpage/version5.0/bin/owsadm.exe
Uninstall and then install for re-installations
FP files are found as _vti-bin, _vti-pvt, _vti-cnf, vti-log inside the public_html

Mysql
=======
Program : /usr/bin/mysql
Init Script : /etc/rc.d/init.d/mysql
Conf : /etc/my.cnf, /root/.my.cnf
Data directory - /var/lib/mysql - Where all databases are stored.
Database naming convention - username_dbname (eg: john_sales)
Permissions on databases - drwx 2 mysql mysql
Socket file - /var/lib/mysql/mysql.sock, /tmp/ mysql.sock

SSHD
======
Program :/usr/local/sbin/sshd
Init Script :/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
Log: /var/log/messages

Perl
====
Program :/usr/bin/perl
Directory :/usr/lib/perl5/5.6.1/

PHP
====

Program :/usr/local/bin/php, /usr/bin/php
ini file: /usr/local/lib/php.ini - apache must be restarted after any change to this file
php can be recomplied using /scripts/easyapache

Named(BIND)
============
Program: /usr/sbin/named
Init Script: /etc/rc.d/init.d/named
/etc/named.conf
db records:/var/named/
/var/log/messages

--------------------------------------------------------------------------------------------------------------------------------------

Cpanel installation directory structure
=============================
/usr/local/cpanel
+ 3rdparty/ - tools like fantastico, mailman files are located here
+ addons/ - AdvancedGuestBook, phpBB etc
+ base/ - phpmyadmin, squirrelmail, skins, webmail etc
+ bin/ - cpanel binaries
+ cgi-sys/ - cgi files like cgiemail, formmail.cgi, formmail.pl etc
+ logs/ - cpanel access log and error log
+ whostmgr/ - whm related files

WHM related files
===============
/var/cpanel - whm files
+ bandwidth/ - rrd files of domains
+ username.accts - reseller accounts are listed in this files
+ packages - hosting packages are listed here
+ root.accts - root owned domains are listed here
+ suspended - suspended accounts are listed here
+ users/ - cpanel user file - theme, bwlimit, addon, parked, sub-domains all are listed in this files
+ zonetemplates/ - dns zone template files are taken from here

Common CPanel scripts
===================
cpanel/whm Scripts are located in /scripts/
+ addns - add a dns zone
+ addfpmail - Add frontpage mail extensions to all domains without them
+ addfpmail2 -Add frontpage mail extensions to all domains without them
+ addnetmaskips - Add the netmask 255.255.255.0 to all IPs that have no netmask
+ addnobodygrp - Adds the gorup nobody and activates security
+ addpop - add a pop account
+ addservlets - Add JSP support to an account (requires tomcat)
+ addstatus - (Internal use never called by user)
+ adduser - Add a user to the system
+ bandwidth - (OLD)
+ betaexim - Installs the latest version of exim
+ biglogcheck - looks for logs nearing 2 gigabytes in size
+ bsdcryptoinstall - Installs crypto on FreeBSD
+ bsdldconfig - Configures the proper lib directories in FreeBSD
+ bsdpkgpingtest - Tests the connection speed for downloading FreeBSD packages
+ buildbsdexpect - Install expect on FreeBSD
+ builddomainaddr - (OLD)
+ buildeximconf - Rebuilds exim.conf
+ buildpostgrebsd-dev - Installs postgresql on FreeBSD.
+ chcpass - change cpanel passwords
+ easyapache - recompile/upgrade apache and/or php
+ exim4 - reinstall exim and fix permissions
+ fixcommonproblems - fixes most common problems
+ fixfrontpageperm - fixes permission issues with Front Page
+ fixmailman - fixes common mailman issues
+ fixnamed - fixes common named issues
+ fixndc - fixes rndc errors with named
+ fixquotas - fixes quota problems
+ fullhordereset - resets horde database to a fresh one - all previous user data are lost
+ initquotas - initializes quotas
+ installzendopt - installs zend optimizer
+ killacct - terminate an account - make sure you take a backup of the account first
+ mailperm - fixes permission problems with inboxes
+ park - to park a domain
+ pkgacct - used to backup an account
+ restartsrv - restart script for services
+ restorepkg - restores an account from a backup file ( pkgacct file)
+ runlogsnow - update logs of all users
+ runweblogs - update stats for a particular user
+ securetmp - secures /tmp partition with options nosuexec and nosuid
+ suspendacct - suspends an account
+ unsuspendacct - unsuspends a suspended account
+ upcp - updates cpanel to the latest version
+ updatenow - updates the cpanel scripts
+ updateuserdomains - updates userdomain entries
Important cpanel/whm files
====================
/etc/httpd/conf/httpd.conf - apache configuration file
/etc/exim.conf - mail server configuration file
/etc/named.conf - name server (named) configuration file
/etc/proftpd.conf - proftpd server configuration file
/etc/pure-ftpd.conf - pure-ftpd server configuration file
/etc/valiases/domainname - catchall and forwarders are set here
/etc/vfilters/domainname - email filters are set here
/etc/userdomains - all domains are listed here - addons, parked,subdomains along with their usernames
/etc/localdomains - exim related file - all domains should be listed here to be able to send mails
/var/cpanel/users/username - cpanel user file
/var/cpanel/cpanel.config - cpanel configuration file ( Tweak Settings )*
/etc/cpbackup-userskip.conf -
/etc/sysconfig/network - Networking Setup*
/etc/hosts -
/var/spool/exim -
/var/spool/cron -
/etc/resolv.conf - Networking Setup--> Resolver Configuration
/etc/nameserverips - Networking Setup--> Nameserver IPs ( FOr resellers to give their nameservers )
/var/cpanel/resellers - For addpkg, etc permissions for resellers.
/etc/chkserv.d - Main >> Service Configuration >> Service Manager *
/var/run/chkservd - Main >> Server Status >> Service Status *
/var/log/dcpumon - top log process
/root/cpanel3-skel - skel directory. Eg: public_ftp, public_html. (Account Functions-->Skeleton Directory )*
/etc/wwwacct.conf - account creation defaults file in WHM (Basic cPanel/WHM Setup)*
/etc/cpupdate.conf - Update Config *
/etc/cpbackup.conf - Configure Backup*
/etc/clamav.conf - clamav (antivirus configuration file )
/etc/my.cnf - mysql configuration file
/usr/local/Zend/etc/php.ini OR /usr/local/lib/php.ini - php configuration file
/etc/ips - ip addresses on the server (except the shared ip) (IP Functions-->Show IP Address Usage )*
/etc/ipaddrpool - ip addresses which are free
/etc/ips.dnsmaster - name server ips
/var/cpanel/Counters - To get the counter of each users.
/var/cpanel/bandwidth - To get bandwith usage of domain

Methods to reduce server load

1 )netstat -plan | grep :80 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

2) netstat -plan | grep :25 | awk '{print $5}' | cut -d: -f 1 | sort | uniq -c | sort -n

3) pstree -paul

4) cd /tmp

5) rm -f dos-* sess_* .spamassassin*

6) find . -user nobody -exec rm -f '{}' \;

7) ps -C exim -fH ewww

8) ps -C exim -fH eww |grep home

9) netstat -ntu | grep ':' | awk '{print $5}' | awk '{sub("::ffff:","");print}' | cut -f1 -d ':' | sort | uniq -c | sort -n

10) mysqladmin proc |grep Sleep |awk {'print $4'}|cut -d_ -f 1|sort|uniq -c|sort -nk 1

11) ps -C exim -fH ewww

12) for i in `ipcs -s | awk '{print $2}'`; do (ipcrm -s $i); done

13) for i in `mysqladmin proc |grep Sleep |cut -d " " -f 2`; do mysqladmin kill $i; done

14) exim -bp |grep "*** frozen ***" |awk '{print $3}' |xargs exim -Mrm

15) exiqgrep -z -i | xargs exim -Mrm;exiqgrep -o 432000 -i | xargs exim -Mrm