Tuesday, November 16, 2010

How to install Joomala

Steps for Joomla Intallation:-

First wget the pachage

1) wget http://joomlacode.org/gf/download/frsrelease/6828/22537/Joomla_1.0.15-Stable-Full_Package.tar.gz

2) Change the ownership for Joomla package.

3) extact the package:-
tar -xzvf Joomla_1.0.15-Stable-Full_Package.tar.gz

4) Change the ownership of content,
  For exampal : chown tunerpar.tunerpar * -R

5) Open the site in browser
l
chmod 777 administrator/backups/
chmod 777 administrator/components/
chmod 777 administrator/language/
chmod 777 administrator/language/en-GB/
chmod 777 administrator/modules/
chmod 777 administrator/templates/
chmod 777 components/
chmod 777 images/
chmod 777 images/banners/
chmod 777 images/stories/
chmod 777 language/
chmod 777 language/en-GB/
chmod 777 language/pdf_fonts/
chmod 777 media/
chmod 777 modules/
chmod 777 plugins/
chmod 777 plugins/content/
chmod 777 plugins/editors/
chmod 777 plugins/editors-xtd/
chmod 777 plugins/search/
chmod 777 plugins/system/
chmod 777 plugins/user/
chmod 777 plugins/xmlrpc/
chmod 777 tmp/
chmod 777 templates/
chmod 777 Cache Directory /home/rsvpwebd/public_html/cache/
chmod 777 Cache Directory /home/rsvpwebd/public_html/administrator/cache/
chmod 777 tmp/
chmod 777 /home/rsvpwebd/public_html/cache/
chmod 777 administrator/backups/

6) Create configuration file,
touch configuration.php

7) Change the ownership for config file
chown tunerpar.tunerpar configuration.php

8) If php global setting is on then enter the code in .htaccess file
To tunn of the setting:-
php_flag register_globals off
To make writable session save path, Just put the following code in your .htaccess file:
php_value session.save_path '/tmp'

9) Make writable confi file
chmod 666 configuration.php

10) Add username "localhost"

11) create a database ,username and password and fill it in blank fields.

12) Insert email ID of user.

13) Save the admin login.

14) Click on view site and then rename the installation directory and refesh the browser,

THATS IT YOUR JOOMLA SITE IS READY TO USE.
------------------------------------------------------------------------------------------------

HOW TO COPY WEBSITE

HOW TO COPY WEBSITE FROM:- http://abc.com/ to abc1.com with database

Steps are as follows :-

.Open two shells ( one with abc.com and other abc1.com )

.then copy public_html of abc.com to abc1.com

.go to public_html folder of abc.com and hit the command 

.[root@server public_html of abc.com]# cp -R * /home/abc1/public_html

.Change the ownership of the files copied under public_html of abc1.com

.Then take backup of mysql datatbase of abc.com
.mysqldump abc_databasename > abc_databasename.sql   ( of abc.com)
.Create a new database and username under abc1.com ( add user to database, make a note of db name, user & password)
.then go to Shell and enter the following command:-
mysql -u abc1_user -ppassword abc1_databasename < abc_databasename.sql
Then go to the configuration file and do the changes accordingly.

And your site has been copied with database  to new site.

All Done.

Saturday, November 6, 2010

How to install DOS-Deflate

Just follow given instruction below:-

How to install:-

Installing DOS-Deflate is so simple.

Informations is as follows :-

When you run this Perl script it will then run an netstat command check how many times each IP is connected & if there are more then the number of connections you specified then it will automatically run a command in APF for the IP to be banned,

******************************

Login to your server as root.

Download the install script.
wget http://www.inetbase.com/scripts/ddos/install.sh

******************************

Run the installer.
sh install.sh

******************************

DOS-Deflate should now be installed

******************************

Please note that DOS-Deflate uses APF to ban IPs so you must have it installed for DOS-Deflate to work properly,

******************************

Customizing DOS-Deflate is very easy. You have to edit /usr/local/ddos/ddos.conf with your favorite editor for example:-


vi /usr/local/ddos/ddos.conf

Every setting is explained in the configuration file so I will not go over them as the explanations are quite easy to follow up:

Read also "How To Install Apf <advanced Policy Firewall>" if you haven't set up apf firewall in your box.

This way we can protecting ourself from ddos attack, Such attacks are so common nowadays, all website owners should look into protecting their sites from such attacks

******************************

Full Info of PHP

//To check php info of a domain enter the following code in a file in pulic_html of the domain //

******************

<?phpinfo();?>

******************

And then all the info will POP on your screen up to you .

Thursday, November 4, 2010

spamming from user by hidding domain name

Refer the solution given below:-

It seems that some user is spamming from your server,then for quick action clear the exim mail queue.

'rm -rf /var/spool/exim/input' 

It will do it, But you should investigate more & find the source script or domain & take actions so as to really help you out of this kind of issue.

**************************
Fire the below mentioned command at your command prompt to find the domain which is being used by spammers for spamming.

# exim -bpr | exiqsumm -c | head

And Then,

#exiqgrep -ir <domain> | xargs -n1 exim -Mrm

That should remove any Email that is in the queue that is waiting to be delivered to POP accounts at [domain].

Stats not working ?

If the Stats in the server are not working please follow the given instruction:-

WHM -> Server Configuration -> Tweak Settings ' Delete each domain's access logs after stats run ' must be unchecked ,After this it should work properly.

There are also some scripts available to fix this issue:- 

/scripts/updatenow

/scripts/updateuserdomains

/scripts/fixeverything

/scripts/upcp –force
******************************************************

Solution on MIME

Follow the Instruction  given below:-

If your web site is running on linux server and want to make it stream windows media,Then you have to do following steps:-


                                                     Step< 1 >
 
First, you have to configure mime type in apache web server to recognize the windows media file .asx .


                                                    Step< 2 >

Log on to linux server as a root, At the dollar prompt, type as following below

Change directory to etc folder
$ cd /etc

Edit mime.types file
$ vi mime.types


                                                   Step< 3 >

Then press i at your keyboard to enter text below You can place this text below any where in the file mime.types.

Application/x-mplayer2 asx m3u


                                                    Step< 4 >

Then press Esc key.


                                                   Step< 5 >
Then press Shift key and colon key, You will see, it appears at the bottom of the file.

Type as below at colon prompt to quit and save

:wq

*********************************************************

How to fix the error "License File Expired"

To deal with such issue is very easy just follow given steps:-

First we need to check the license on http://verify.cpanel.net/ to ensure that it is still licensed
If it's not , Then please contact who you purchase the license from directly.

If it says it is valid, try the following commands as root via SSH:-

# rdate -s rdate.cpanel.net

# /usr/local/cpanel/cpkeyclt
-----------------------------------------------------------------------------------------------

What is Bad Blocks

Check out the following commands for BAD BLOCKS :-

Badblocks [options] device block-count.
    
    System administration command, Search device for bad blocks. You must specify the number of blocks on the device (block-count). e2fsck and mke2fs will invoke badblocks automatically when given the -c option.

Options:-

-b 
    blocksize

    Expect blocksize-byte blocks,

*************************************
-c   blocksize

    Test blocksize-byte blocks at a time. Default is 16,

 ************************************
-f

    Force a read/write or nondestructive write test on a mounted device. Use only when /etc/mtab incorrectly reports a device as mounted.

*************************************
-i file

    Skip test of known bad blocks listed in file.

 *************************************
-n

    Perform a nondestructive test by writing to each block & then reading back from it while preserving data,

*************************************
-o file

    Direct output to file,

*************************************
-p number

    Repeat search of device until no new bad blocks have been found in number passes, Default is 0.

*************************************
-s

    Show block numbers as they are checked,

*************************************
-t pattern

    Test blocks by reading and writing the specified pattern. You may specify pattern as a positive integer or as the word random, If you specifiy multiple patterns, badblocks will test all blocks with one pattern, and then test all blocks again with the next pattern. Read-only mode will accept only one pattern, It will not accept random.

*************************************
-v

    Verbose mode.

*************************************
-w

    Test by writing to each block and then reading back from it.

------------------------------------************---------------------------------------

how t o Setting / customising Server Security

Fire the following command on the server :-


#system-config-securitylevel

 & also

/etc/sysconfig/selinux


Properly Rejected Invalid Emails

Just read the method given below to resolve this issue :-

Mail queue fill up with bounce messages to non-existant spammer email addresses, By default. If an email comes into your server addressed to an invalid recipient, Exim will accept the message from the delivering agent, and then generate a return email to them explaining that the address is invalid, With this little tweak, you can make exim tell the delivering agent,Tthat address is invalid at the time the message is being delivered.

********************************************************************

Method <1>
. Open WHM and click on Exim Configuration Editor

. Click on the Switch to Advanced Mode button.
. Scroll down until you see the section on ACL's. You'll see three boxes. In the middle box, locate the section that reads - See Section A:
--------------------------------------------------------------------------------------------

Method <2> Recommended

. Login into SSH and su to root.

. pico /etc/exim.conf

. Ctrl + W and type in: accept  domains , Notice the two spaces. Look for something like this below.


Section A :-

accept  domains = +local_domains
accept  domains = +relay_domains
accept  hosts = +relay_hosts
accept  condition = ${perl{checkrelayhost}{$sender_host_address}}

Between

accept domains = +local_domains

&

accept domains = +relay_domains

add the following:

endpass
message = unknown user
verify = recipient

Make sure each line lines up,You might need to add two spaces before each line, The final section will look like this. :-

accept domains = +local_domains
endpass
message = unknown user
verify = recipient
accept domains = +relay_domains
accept hosts = +relay_hosts
accept condition = ${perl{checkrelayhost}{$sender_host_address}}

Scroll all the way to the bottom and click on Save.

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

Wednesday, November 3, 2010

Commands to open tcp or udp ports on the server

 Following commands use to open tcp or udp ports on the server:-

< Before using commands for opening the port,Please make sure the specific port is already opened & what is the use of that port >

You can verify the port with 

netstat -nap | grep : <port no>

(1)  You can open TCp port with.

iptables -A INPUT  -p tcp –dport <port no> -j ACCEPT
 ---------------------------------------------------------------------------------- 
(2) You can open UDP port with

iptables -A INPUT -p udp –sport <port no>  -j ACCEPT

after that
 ----------------------------------------------------------------------------------
(3) Service iptables save

and for flushhing iptables us

iptables -F 

 iptables -A INPUT -s 210.0.143.122 -j DROP

203.162.3.147

iptables -L

service iptables save
--------------------------------------------------------------------------------------
THATS IT YOU DONE 

How to register a domain with using extra IPS

Let's get started with following simple steps :-

1 >
       Login to your registrar panel (Godaddy, Enom, etc..).
2 > 
      Select the domain you want to use & find where you can 'Register New DNS',
3 >
      Put in ns1.yourdomain.com and ns2.yourdomain.com in the respective fields.
4 >
      Put in the IP addresses [either yours or the ones provided to you by your host]
5 >
      Hit the save or submit button.
    ** NOTE:- If you are a regular reseller the rest is done by your host on their end so notify them that you            .         have done your part, If you run a dedicated server, read on.
6 >
      Login to your WHM panel as "root",
7 >
      Go to 'Reseller Center', select 'mydomain.com'. Click on the 'Edit Domains/Privilages' icon.
8 >
      When the page loads scroll down & put in the new nameservers, in this case ns1.mydomain.com &  
          ns2.mydomain.com.
9 >
       Save them & scroll down to 'DNS Function' and select 'Edit DNS Zone'.
10 >
      You will notice that the new nameservers are now located in the top 2 text fields, Scroll all the way down 
          to where it says 'Add new A entries'.
11 > 
        In the first text field put in the nameserver & in the second empty text field put in the IP address. So, it 
          will look something like this:-

          ns1.mydomain.com 14400 IN A 1.1.1.1

          ns2.mydomain.com 14400 IN A 1.1.1.2
12  > 
         Click Save & you are done Enjoy.
-------------------------************************-----------------------------

Tuesday, November 2, 2010

How to Catch spammers on C-panel

**Just follow given steps :-



<Follow the steps given below to catch Spammers sending mails from scripts ( nobody emails )> :-

1> Edit /etc/exim.conf
 ------------------------------------------------------------------------
2>On the second line add :-

log_selector = +address_rewrite +all_parents +arguments +connection_reject +delay_delivery +delivery_size +dnslist_defer +incoming_interface +incoming_port +lost_incoming_connection +queue_run +received_sender +received_recipients +retry_defer +sender_on_delivery +size_reject +skip_delivery +smtp_confirmation +smtp_connection +smtp_protocol_error +smtp_syntax_error +subject +tls_cipher +tls_peerdn \

Make sure all that comes on a single line,
 ------------------------------------------------------------------------
3>Save and exit,
 ------------------------------------------------------------------------ 
4>Restart Exim,

A keep a watch on /var/log/exim_mainlog as you should be able to trace path to directory from which the spammer(s) is / are spamming,
 ------------------------------------------------------------------------

**If the spammer is not spamming using formmail scripts then go through following steps :-

1]> Get the message ID from the header of the spam, It should be in format like 1DWJj4-00042i-74 ( this is the most important step else all thats given below is crap ).

2 ]> grep exim_mainlog with the message ID, ( Ex : grep 1DWJj4-00042i-74 /var/log/exim_mainlog ).

3 ]> Check the time on which the spam was sent and also check all that is shown after grep,

4 ]> If you find out the domain name or path of the scripts from exim_mainlog then go ahead & suspend the spammer, else proceed to step 5.

5 ]> Use this message ID to check the original message or bounced message in /var/spool/exim/input/. You should see 2 files there, one with -D at end & one with -H at the end, 
( Ex : /var/spool/exim/input/4/1DWJj4-00042i-74-D & /var/spool/exim/input/4/1DWJj4-00042i-74-H ) This 2 files will have all the information that was sent in the spam message & if it was sent using mailing list then you will catch the username of spammer in auth_sender part of this files, If it shows nobody then its your bad luck Proceed to step 6.

6 ]> If exim_mainlog shows the spams originating from /tmp of the server & check the file in /tmp of the server. wner of the file will be seen as nobody:nobody, Take down the time of creation of file. This time is what we need to find out who uploaded the script, You will need to convert this time into the time format of /usr/local/apache/logs/error_log & then in the format of the domlogs located at /usr/local/apache/domlogs/*

7 ]> for file in /usr/local/apache/domlogs/*; do cat $file |grep “example”; done; ( you cannot do direct grep for the query here as it will give error that the arguement list is too long ).

8 ]> If the results in step (2) have shown some domain name or some username in common as sender of the spam but now you dont see that domain name on the server then check /var/cpanel/accounting.log to see if that account has been terminated from the server ( Ex : grep ebayspammer.com /var/cpanel/accounting.log ).

All that we need to know is importance of /var/log/exim_mainlog, /var/log/formmail.log, /usr/local/apache/logs/error_log, /usr/local/apache/domlogs/*,
/var/spool/exim/input/*/* and the files uploaded in /tmp of the server, Major spamming issues are caught using the time of sending the spam,You will need to work on your own when you get across such issue & use your logic to convert the time of sending the spams to the time format of respective log files I mentioned above,
*****************************************************************

How to take backup

**Following steps will guide how to take back up :-



**NOTE :-You will have to take fullbackup of all the accounts from your previous hosting panel with the following steps.(your previous hosting should have C-panel).

** Login to the individual account control panel.

** You will find an option called as "Backup"

** Click into it.

** In there you will find any option called "Generate/Download a Full Backup"

** Click in it and the backup process will start

** Later on you will have to move the database from the old server to the new server through FTP and we would help you in restoring all the backedup file back to normal

----------------------------*****************----------------------------

Simple function FIND

Fire following command on Server :-

find . -type f -exec grep a7rar '{}' ';'

Monday, November 1, 2010

POP3/IMAP Server

Some steps are given below  :-


Install Dovecot(POP3/IMAP Server):-

****

    Dovecot is a very popular POP3/IMAP Server, The main Difference beween POP3 &IMAP is while accessing your EMAIL with outlook if you use POP3 & IMAP the mail is download to your COMPUTER & DELETED from Server,With IMAP the mail is retained in the server,If any problem occurs while downloading the EMAIL are lost with POP3, The configuration file is located at /etc/dovecot.conf

yum install dovecot

****
  
   Open the dovecot config file.etc/dovecot.conf & make tis following chnages.You may need to comment / uncomment certain lines

protocols=imap imap pop3 pop3s

****

   Look for the line auth default  & male these changes,Be careful with the lines as they are heavily commented out.

auth default{
mechanisms=plain login
passdb pam{
}
userdb passwd{
}
socket listen{
client{
path=/var/spool/postfix/private/auth
mode=0660
user=postfix
group=postfix
}
}
---------------------------------------------------------------------------------------

How to configure Outlook

 Following steps are useful for setup an account in outlook : -
-----------------------------------------------------------------------------

*  Open up outlook express.
*  Goto the menu at the top called "Tools".
*  On the menu please select "Accounts".
*  Across the top you will see several tabs(all, mail, news, directory service) . Please click on the one entitled   "Mail".
*  Click the add button (found on the right hand side).
*  A menu appears. Please select "mail".
*  Please type in your name,
*  Click Next.
*  Type your emailid in the 'E-mail address',
*  Click Next.
*  Please check that POP3 is selected at the top of the screen,
*  In the field called "Incoming mail(POP3, IMAP OR HTTP) server" please type in "mail.<domainname>" 
*  In the field called "Outgoing mail(SMTP) server" please type in the smtp server that your isp gave you for example:-
mail.<domainname>
*  Click next.
*  In the field entitled "Account name" please type your account name,
*  In the field entitled "Password" please type in your password. This password was the password you used  when you set up your mailbox,
*  Click the "next" button,
*  Click "finish",
*  Click "close",
-----------------------------------------------------------------------------------------
This will setup a new  account,So click the button "send/recv" to check it.

what is DOS Attack

Some basic commands :-


DOS attack :-

/home/virtual/public_html/vtc

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

- This will also help you :-

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

route add xxx.xx.xx.xxx reject

netstat -n | grep :80 | wc -l;uptime ; netstat -n | wc -l

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

- Also do this to lower down the server load :-

Steps to lower the load, If you want stats to continue to run even with a high load,Then Edit

/var/cpanel/cpanel.config & change extracpus to a number larger then 0 


(run/usr/local/cpanel/startup afterwards to pickup the changes)

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

How to Disable PING Command on server

Command to disbale ping on the server:-

                            
                          Step 1)-

Command to disable PING:-

echo "1" >> /proc/sys/net/ipv4/icmp_echo_ignore_all

********************************************
                             
                             Step 2)-

Command to enable PING :-

echo "0" >> /proc/sys/net/ipv4/icmp_echo_ignore_all

**********************************************
                              
                             Step 3)-

**Note:--Ping can also be disbale to following command :-

# iptables -A INPUT -p icmp -j DROP


***********************************************

How to check CRON JOB

Just Fire Following Command On The Server :-

**This is to check users cron job**

Command :-

   crontab -u mwda0820 -l

Thursday, October 28, 2010

Optimize hard drive access performance

Simple steps for optimizing HARD DRIVE access performance is give below:-



** Hdparm:-
      [The following optimizations techniques can be applied to (E)IDE drives to utilize 32 bit I/O & DMA more effectively. ]
---------------------------------------------------------------------------------

Step 1:-

**Get info: hdparm /dev/hda 
**Get more info: hdparm -I /dev/hda 
**Test Speed: hdparm -tT /dev/hda 
**Increase Speed: hdparm -d1 -c3 -u1 /dev/hda 







Step 2:-

-d1: Turn on DMA (0: off) 
-c3: IDE chipset support 
0: Disable 
1: Enable 
3: 32 bit transfer 

 
-u1: Get/set interrupt umask. Driver ignores other interrupts during processing of disk interrupts. (0: off) 
 

Test Speed Again: hdparm -tT /dev/hda 
 

The Red Hat 7.1+/8.0 configuration uses /etc/rc.sysinit to call scripts /etc/sysconfig/harddisks. 

(Earlier systems used: /etc/sysconfig/harddiskhda, /etc/sysconfig/harddiskhdb, etc) to run hdparm upon boot. 
 

File: /etc/sysconfig/harddisks: 

    USE_DMA=1
    EIDE_32BIT=1

**Note:- Turn off hdparm DMA access: hdparm -d0 /dev/hda 
Links: 

** hdparm man page.
-Optimizing hard drive performance with hdparm. 
  (ATA, UDMA & hdparm)



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

Tuesday, October 26, 2010

How to test if Linux server disk (SCSI / SATA) or hard disk going bad

Read the solution and follow some useful steps :- 
One of our regular sends us a question:-

    How can I test if my hard disk is going bad? I see few errors in /var/log/messages file.

I/O errors in /var/log/messages indicates that something is wrong with the hard disk and it may be failing.

Next thing is check hard disk for error using smartctl command, which is control and monitor utility for SMART disks.

smartctl controls the Self-Monitoring, Analysis and Reporting Technology (SMART) system built into many ATA-3 and later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to monitor the reliability of the hard drive and predict drive failures, and to carry out different types of drive self-tests.

smartctl is a command line utility designed to perform SMART tasks such as printing the SMART self-test and error logs, enabling and disabling SMART automatic testing, and initiating device self-tests.

Make sure S.M.A.R.T. support is enabled in the BIOS.

Next run following command to see if your hard disks support S.M.A.R.T technology:
# smartctl -i /dev/sdb

Now enable SMART:
# smartctl -s on -d ata /dev/sdb
Output:

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF ENABLE/DISABLE COMMANDS SECTION ===
SMART Enabled.

Now run overall-health self-assessment test:
# smartctl -d ata -H /dev/sdb
Output:

smartctl version 5.33 [x86_64-redhat-linux-gnu] Copyright (C) 2002-4 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

You can read more data from hard disk by typing following command:
# smartctl -d ata -a /dev/sdb

A note about RAID controller

To look at ATA disks behind 3ware SCSI RAID controllers, use syntax such as:
# smartctl -a -d 3ware,2 /dev/sda
# smartctl -a -d 3ware,0 /dev/twe0
Extended self-test of drive

You need to begin an extended self-test of drive /dev/hdc. You can issue this command on a running system. The results can be seen in the self-test log visible with the ´-l selftest´ option after it has completed.
# smartctl -d ata -t long /dev/sdb

If any one of these test reports error, replace hard disk and restore data from backup.

BLock Port IN iptables

Fire this command on server :-

iptables -A FORWARD -p tcp --dport 25 -j DROP

Sunday, October 24, 2010

Authentication Error when Changing User Passwords in Linux

Authentication Token Manipulation Error when Changing User Passwords in Linux :-
*********************************************************************************

Error on the screen  :-
-----------------------------------------------------------------------------------------------------------
You may get an error, such as Authentication Token Manipulation Error, while trying to change passwords for a user.

For example :-

#passwd user

#Authentication Token Manipulation Error


*Note:- 


1)
      This error is being produced because you are using shadowed password files & the shadow does not have entry for this user. i.e, /etc/passwd has an entry for this user, but /etc/shadow does not.

2)
       In order to resolve this, you can either add the entry manually or recreate the shadow file. You can use pwconv to recreate the shadow file, See the manpage for more details on this.

**********************************************************************************

IP Attack

How to insert an -IP- into firewall is given below :-

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

Step 1)--

 first check which IP is hitting your site number of times by :-

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

-------------------------------------------------------------------------------------------------------
Step 2)--

 Then you can insert this IP into firewall by :-

apf - d  ip

to allow an ip ;

foist remove the entry from deny_hosts.rules using pico command & then execute.

apf  -a  ip

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

Error (98)Address already

Error :-

If we get this kind of  error, of while try to restart  httpd:httpd  not running, trying to start

(98)Address already in use:- make_sock: could not bind to address 0.0.0.0:443
no listening sockets available, shutting down

**************************************************************

-- Unable to open logs Then Simply fire the command which is given below :-

netstat -lpn | grep '0.0.0.0:80'

It will show the result something like:

tcp        0      0 0.0.0.0:80                  0.0.0.0:* LISTEN      14829/httpd

*Note:- Then kill the PID & kill all the processes of the service & try to restart it.

***************************************************************
This will fix the (98)Address already in use error.

Error given by Squirrel-Mail and Horde-Mail

Error on the screen will be like this  :-

root@fs1 [/scripts]# ./fixwebmail
chown: cannot access `/usr/local/etc/cpanel/base/webmail/data': No such file or directory
chmod: cannot access `/usr/local/etc/cpanel/base/webmail/data': No such file or directory

--------------------***********--------------------***********-------------------

Just follow few steps is given below to solve this kind of issue :-
-------------------------******************-------------------------
Step 1

 Try to Un-checking HordeMail & SquirrelMail in WHM >> Tweak Settings >> Save >> Re-check >> Save.

Then try it now.

 -------------------------*******************-------------------------

Step 2 


A) 

Is there any usecpphp file in /var/cpanel/ directory?.

If not create it by the following command

touch /var/cpanel/usecpphp

B)

If the file is Still exist,Then run the following commands :-

cp -p /usr/local/cpanel/base/3rdparty/squirrelmail/config/config_default.php /usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php
C)

This will solve your problem, If problem Still exists run the following commands on server :-

/scripts/updatenow
/scripts/makecpphp

-------------------------*******************-------------------------


Server replied 110 can't open SMTP Stream

If you get following kind of Error :-

**********************************************************
Error display on the screen :-

Connection timed out
Server replied: 110 Can't open SMTP stream.

**********************************************************

1)-I found the config for cpanel's SM :-

/usr/local/cpanel/base/3rdparty/squirrelmail/config/config.php

***********************************************************
2) - Just changed :-

$useSendmail = false;

to:-

$useSendmail = true;

[Around line 33]

*Note :-This will probably get written over with the next cpanel update, but it at least helps get my users sending mail again.

That's it try out this will resolve your problem.

***************************************************************

Path of Httpd for individual user

Its so simple just fire this command on server :-
-------------------------------------------------------------------------------

Path of Individual Httpd Files :-

[root@fs5 /usr/local/apache/conf/sites/

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

How to install Mytop

To Install Mytop Fire this Command on the Server :-
---------------------------------*******************------------------------------

wget http://dll.elix.us/mytop-1.4.tar.gz

tar -zxvf mytop-1.4.tar.gz

cd mytop-1.4

perl Makefile.PL

make

make test

make install

*****************************************************************

*Note :- To Access MyTop Fire is this command on the sever :-

[root@mss ~]#mytop

*******************************************************************

Max connection to MySql



To set Max-connections for mysql just add this following lines :-


----------------******************************-------------------
max-connections=150

below

#old_passwords=1

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

How To Transfer Account Manually

To transfer an account using shell is as follows :-

--------------------*****************************----------------------

1)-Commands to run on the "Old Server".

/scripts/pkgacct (user name)

Change permmissions to 755.

Change owner to nobody.nobody.

move tar file to /usr/local/apache/htdocs

*********************************************************

2)-Commands to run on "New Server".

wget http://67.45.15.26/cpmove-sacrowd.tar.gz/scripts/restorepkg sacrowd

*********************************************************

Installing YUM

*Note-Please first Download the .tar source & Set it up it is not hard read the read-me file in it.

Fire this commands given below :-

As root,
cd ~
mkdir setups
cd setups
wget http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.7.tar.gz
tar -xvzf yum-2.0.7.tar.gz
cd yum-2.0.7
./configure
make
make install
----------------------------------------------------------
Its so simple isn't it.

How to install spam log

***Following are the steps to install Spam_log***


-------------************************--------------
 1)- Login to your server & su - to root.

****************************************************

 2)-Turn off exim while we do this so it doesn't freak out :-

#/etc/init.d/exim stop

****************************************************

 3)-Backup your original /usr/sbin/sendmail file, On systems using Exim MTA, the sendmail file is just basically a pointer to Exim itself :-

#mv /usr/sbin/sendmail /usr/sbin/sendmail.hidden

****************************************************

4)-Create the spam monitoring-script for the new sendmail :-

#pico /usr/sbin/sendmail

Paste in the following:-

#!/usr/local/bin/perl
# use strict;
use Env;
my $date = `date`;
chomp $date;
open (INFO, ">>/var/log/spam_log") || die "Failed to open file ::$!";
my $uid = $>;
my @info = getpwuid($uid);
if($REMOTE_ADDR) {
print INFO "$date - $REMOTE_ADDR ran $SCRIPT_NAME at $SERVER_NAME n";
}
else {

print INFO "$date - $PWD - @infon";

}
my $mailprog = '/usr/sbin/sendmail.hidden';
foreach (@ARGV) {
$arg="$arg" . " $_";
}

open (MAIL,"|$mailprog $arg") || die "cannot open $mailprog: $!n";
while (<STDIN> ) {
print MAIL;
}
close (INFO);
close (MAIL);

****************************************************

 5)-Change the new sendmail permissions :-

#chmod +x /usr/sbin/sendmail

****************************************************

6)-Create a new log file to keep a history of all mail going out of the server using web scripts :-

#touch /var/log/spam_log

chmod 0777 /var/log/spam_log

****************************************************

7)-Start Exim up again :-

#/etc/init.d/exim start

****************************************************

8)-Monitor your spam_log file for spam, try using any formmail or script that uses a mail function - a message board, a contact script :

#tail - f /var/log/spam_log

Sample Log Output

Mon Apr 11 07:12:21 EDT 2005 - /home/username/public_html/directory/subdirectory - nobody x 99 99 Nobody / /sbin/nologin

Log Rotation Details :-
Your spam_log file isn't set to be rotated so it might get to be very large quickly, Keep an eye on it and consider adding it to your logrotation.

#pico /etc/logrotate.conf

FIND :-

/var/log/wtmp {
monthly
create 0664 root utmp
rotate 1
}

ADD BELOW :-

# SPAM LOG rotation
/var/log/spam_log {
monthly
create 0777 root root
rotate 1
}

****************************************************
Now Just sit and enjoy .

How to install IPtables

This are some basic steps for install IP tables:-


1)  Get the iptables tarball containing all the needed files.-

          -To get the latest version of iptables go to netfilter.org

          - Downloads are available at http://www.netfilter.org/downloads.html

          - The file should be named iptables-1.*.*.tar.bz2 where the asterisks represent the numbers of the       latest version.

          -Save this file to a temporary directory, we will use /tmp in this example.
-----------------------------------------------------------------------------

 2) Open a terminal window.

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

 3) Change your directory to where you saved iptables by typing:-

      # cd /tmp

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

4) Uncompress the archive to the /usr/src directory by typing:-

      # tar -xvjf ./iptables-1.*.*.tar.bz2 -C /usr/src

      where the asterisks represent the version number of the file you downloaded,

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

5) Change to the directory it created (typically iptables-1.*.*), by typing:-

      # cd /usr/src/iptables-1.*.*

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

6) Using the kernel directories above, type:-

      # /bin/sh -c make

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

7) To finish the install, type:-

      # /bin/sh -c make install

- Iptables should now be installed, You can test the installation as described in the beginning of this section to see if it is working.

- If the above install steps seemed to execute without any error, but typing:-

# iptables -V

- Brings up an error, it is possible that the program did'n install itself to the sbin directory, To fix this type the following command from the iptables-1.*.* directory:

ComputerName:~# cp ./iptables /sbin

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

How To change IP in server

*Note:- Hey Remember < You need to set RDNS for the IP then and then Only you can proceed further.>
-------------------------------------------------------------------------------------
If you are in the danger of getting your main server IP block by SpamCop because you had a few anoying spamers abusing your server, then you could simply change your exim mailserver IP to avoid the effect of your main IP beeing blacklisted.

--Below there are some simple steps of changing your exim IP:---

Inside both incoming & outgoing exim mail server you will need to add an interface :-
( So just edit )

pico /etc/exim_outgoing.conf

and

pico /etc/exim.conf

find
remote_smtp:
driver = smtp

& add interface = ip.you.want.to.use

--------------------------------
Example is as shown below:-

remote_smtp:
driver = smtp
interface = 22.22.22.22
-------------------------------

IP needs to be on server in order for this to work, hopefully this will help.
BTW: Just a reminder - If there is an exim update when you upgrade your cpanel server you will need to re-enter the interface again.

How to install postgresql

Follow this step:-

*Not:- C-Panel requires Postgresql 7.3.x or later. 7.2.x will not work.
---------------------------------------------------------------------------

--Step 1--

Upgrade to cPanel 7.4.0 build 45 or later,

--Step 1a --(If you do not have 7.2.x or earlier installed skip this step)

Login to a root shell via ssh or the console,

If you have Postgres 7.2.x installed, backup your databases using pg_dumpall or some other method,

Move the postgres data directory somewhere else. ie,

mv /var/lib/pgsql /var/lib/pgsql.old

---------------------------------------------------------------------------
--Step 2--

Login to a root shell via ssh or the console and run,

/scripts/installpostgres


--Step 2a-- (skip this step if you are not upgrading from postgres 7.2 or earlier)

Restore your sql dump created with pg_dumpall or by some other method using psql or some other method



---------------------------------------------------------------------------
--Step 3--

Login to Web Host Manager & choose "Postgres Config" under Server Setup,

Set a postgres password to anything of your choosing, You should avoid using any non-alpha numeric charaters as these cause problems.


---------------------------------------------------------------------------
--Step 4--

Use the "Postgres Config" option in WHM to install a postgres pg_hba.conf file, You can skip this step if you would like to setup your pg_hba.conf file manually, cPanel should work fine with md5 passwords or plaintext passwords.

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


--Step 5--

Login to cPanel and click on Postgres .. Enjoy!
---------------------------------------------------------------------------

How to clean Exim's Mail queue

Solution How to clean an Exim queue is as follows :-

1) How to clean an Exim queue
2) Using WebHost Manager
3) Advanced Users
4) Very Advanced Users
--------------------------------------------------------------------------------------------

--Using WebHost Manager--

1. Login to WHM.
2. On the Main page, click on the email icon.
3. In the mail menu, select "Manage Mail Queue".
* Note:-( Instead of steps 2 & 3, you can select "Manage Mail Queue from the left margin.)
4. Find the message you wish to delete & select "Delete".

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

--Advanced Users--

There are many times when a mail queue may become filled with what is essentially junk mail, At extreme levels, this can cause high load & delayed mail delivery.
You can use a variation of the following command via a shell prompt to delete only these junk messages from the mail queue.

grep -lR KEYWORD /var/spool/exim/input/* | xargs rm -f

(This will purge the mail queue of any messages that contain KEYWORD.
Any messages deleted in this manner are IRRETRIEVABLE (aka: Gone for good)
Is this dangerous? You bet it CAN be.)

Let's look at an example:-

Imagine a case in which users are abusing a bad FormMail.pl installation on server.fastservers.net. Almost all of these messages will contain the username "nobody@server.fastservers.net". We want to delete ALL of these messages, so we would insert "nobody@server.fastservers.net" in place of "KEYWORD" in the command above.
This will delete all messages in the exim queue that contain the keyword "nobody@server.fastservers.net".

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

--Very Advanced Users--

Grep does regular expressions, This means you can catch tricky spammers with a little mind power.

 For example:-

grep -lRP Vz*Az*Lz*Iz*Uz*M /var/spool/exim/input/* | xargs rm -f

This command will delete any message containing the letters V, A, L, I, U, M, in that order, And with 0 or more "z" characters between them. A few of the keywords it will match are listed:
VALIUM
VzALIUM
VAzLIzUzM
VALzIUM
VzALzIUM
You get the idea.
--------------------------------------------------------------------------------------------

Saturday, October 23, 2010

Frozen messages with Exim

Please follow this fixes listed below :-


1) Solution What are frozen messages?

Ans:-Frozen messages are messages that Exim will no longer attempt to deliver, You can thaw the message with.

      exim -Mt <message-id> [ <message-id> ... ]

2) To remove all frozen messages:-

     exiqgrep -z -i | xargs exim -Mrm

3) To show frozen messages:-

     exim -bp | grep frozen

4) Freeze all queued messages from local user:-

     exiqgrep -i -f luser@localhost | xargs exim -Mf

FrontPage Error fix

Error message on the screen will be like this:-
Error: The server extensions were unable to access the file "..htaccess.tmp". Please check the file permissions.
Setting Password
Frontpage passthough auth enabled!


To solve this follow this commands:-

cd /usr/local/frontpage/version5.0/bin/

./owsadm.exe -o install -u username -p 80 -m www.domain.com -servconf /usr/local/apache/conf/httpd.conf -xuser username

Note:-( Even if you still receive some errors on .htacess files under the domain rename those .htaccess files, This will resolve the permission issues and .htaccess problems.)

Once the above is done- Try to reinstall Frontpage extensions on the domain.

Some Important Exim Commands

Queues information along with commands :-

1)**USE** Print a count of the messages in the queue- Quote:-

              root@localhost# exim -bpc

2)**USE** Print a listing of the messages in the queue (time queued, size, message-id, sender, recipient):
Quote:-

             root@localhost# exim -bp
3)**USE** Print a summary of messages in the queue (count, volume, oldest, newest, domain, and totals)
Quote:-

              exim -bp | exiqsumm

4) **USE**Generate and display Exim stats from a logfile Quote:-

              eximstats /path/to/exim_mainlog
5)**USE** Generate and display Exim stats from a logfile, with less verbose output Quote:-

               eximstats -ne -nr -nt /path/to/exim_mainlog

6) **USE**Generate and display Exim stats from a logfile, for one particular day Quote:-

               fgrep 2007-02-16 /path/to/exim_mainlog | eximstats

7)**USE** Print what Exim is doing right now Quote:-

               exiwhat

8)**USE** How many Frozen mails on the queue :-

               exim -bpr | grep frozen | wc -l
9) **USE**To delete frozen emails Quote:-

               exim -bpr | grep frozen | awk {'print $3'} | xargs exim -Mrm

10) **USE** To deliver emails forcefully Quote:-

               exim -qff -v -C /etc/exim.conf &
11) **USE**To Flush all mail in  queue :-
               exim -qff

To clear Domlogs

Fire the following command :-

cd /usr/local/apache/domlogs/
for x in `ls`;
do
echo "" > $x;
done;

Thursday, October 21, 2010

Using cron to run programs on a schedule

Using cron to run programs on a schedule is very useful feature :-

Cron is a Linux system process that will execute a program at a preset time, To use cron you must prepare a text file that describes the program that you want executed & the times that cron should execute them, Then you use the crontab program to load the text file that describes the cron jobs into cron.

Here is the format of a cron job file:

[min] [hour] [day of month] [month] [day of week] [program to be run]

where each field is defined as
[min] Minutes that program should be executed on. 0-59. Do not set as * or the program will be run once a minute.
[hour] Hour that program should be executed on. 0-23. * for every hour.
[day of month] Day of the month that process should be executed on. 1-31. * for every day.
[month] Month that program whould be executed on. 1-12 * for every month.
[day of week] Day of the week. 0-6 where Sunday = 0, Monday = 1, ...., Saturday = 6. * for every day of the week.
[program] Program to be executed, Include full path information.

Here are some examples below:-

0,15,30,45 * * * * /usr/bin/foo

Will run /usr/bin/foo every 15 minutes on every hour, day-of-month, month, and day-of-week. In other words, it will run every 15 minutes for as long as the machine it running.

10 3 * * * /usr/bin/foo

Will run /usr/bin/foo at 3:10am on every day.

10 * 1 * * /usr/bin/foo

Will run /usr/bin/foo at 12:10am on the first day of the month.

10 * * 1 * /usr/bin/foo

Will run /usr/bin/foo at 12:10am on the first month of the year.

10 14 * * 1 /usr/bin/foo

Will run /usr/bin/foo at 2:10pm on every Monday.


You must use crontab to load cron jobs into cron. First create a text file that uses the above rule to describe the cron job that you want to load into cron. But before you load it, type crontab -l to list any jobs that are currently loaded in crontab.

If none are listed, then it is safe to load your job,Example. If you wanted to run /usr/local/bin/foo once a day at 3:10am, then create a text file

10 3 * * * /usr/bin/foo

Save it as foo.cron. Then type crontab foo.cron. Check to see if it was loaded by typing crontab -l. It should display something like this:

# DO NOT EDIT THIS FILE - edit the master & reinstall.
# (ipwatch.cron installed on Thu Nov 18 11:48:02 2009)
# (Cron version -- $Id: crontab.c,v 2.13 2004/01/17 03:20:37 vixie Exp $)
10 3 * * * /usr/bin/foo

If you want to edit the cron job, then edit foo.cron and then remove the existing cron job (crontab -r) and load it again (crontab foo.cron). You can have multiple jobs. Just put each different one on a seperate line in foo.cron.

contab jobs will run under the user that was in effect when you loaded the job in crontab.

Close connection in response to STARTTLS

---*If you get the following error (tail -F /var/log/messages)---*:-

.----------------------++++++++++++------------------.

T=remote_smtp defer (-18): Remote host mail.domain.com [111.111.111.111] closed connection in response to STARTTLS
2007-10-01 17:15:28 Start queue run: pid=13647
2007-10-01 17:15:28 1IcMzG-0003XG-1f == test@domain.com R=dnslookup

.-----------------------++++++++++++------------------.


Then you can fix this issue by editing your /etc/exim.conf, and changing the following code:-

remote_smtp:
  driver = smtp

To be:-

remote_smtp:
  driver = smtp
  hosts_avoid_tls=*         (This line should be present if not then add the line.)

Save, exit, then restart exim.

If the issue is for incoming email, you can comment out this section of your exim.conf:

tls_advertise_hosts = *

When Server is not responding

When  PhpMyAdmin in your domain control panel gives following error:-
#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured")


link : http://forums.cpanel.net/showpost.php?p=33...mp;postcount=11



Here is what worked for me:-

pico /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

find
$cfg['Servers'][$i]['socket'] = '';

change to

$cfg['Servers'][$i]['socket'] = '/var/lib/mysql/mysql.sock';

next line
$cfg['Servers'][$i]['connect_type'] = 'tcp';

change to

$cfg['Servers'][$i]['connect_type'] = 'socket';



/** I am sure you like this just like me **/