MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

How to Open Passive FTP in iptable?

To Open Passive FTP in iptable root login is require.

If you want to open port range from 30000:64000 then run the following command from shell.

iptables -A INPUT -p tcp -m tcp –dport 30000:64000 -j ACCEPT

Similarly you can open passive post range as per your requirement.

 

What is Core Files in Linux?

A core file created when ever a program terminates unexpectedly and its also useful for determining what caused the termination. In many Linux server by default they do not produce core files when programs crash or terminates unexpectedly.

On  most of the Linux server core file size limitation is set to 0.You can check the core file size limit set in server by using following command.

root@gunjan [~]# ulimit -c
1000000

In above command core file size limit is 1000000 if output occur empty then it means core file size limit haven’t set on server and you can set it as

root@gunjan [~]# ulimit -c 1000000

or

root@gunjan [~]# ulimit -c unlimited

If you want to test core file limit is working on your server or not? then run following command

kill -s SIGSEGV $$

This above command will crashes your shell and produces core file in the current directory. as core.*

If core file is taking lots of disk space on server and you want to disable it then follow the steps one by one.

root@gunjan [~]#which httpd

/usr/sbin/httpd

root@gunjan [~]#pico /usr/sbin/httpd

And following line in /usr/sbin/httpd

ulimit -c 0

And then restart the Apache server

 

How to change timezone on Linux server?

You can change the time zone for your server by using following command.

root@admin[~]#date

Wed Nov 11 19:30:29 EST 2009

For example we are changing time zone  from EST to GMT.

root@admin[~]#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

root@admin[~]#date

Thu Nov 12 00:31:36 GMT 2009

 

How to upgrade kernel version?

First you need to download the latest stable kernel.
You can check it at http://kernel.org/.
Download it :
root@server [~]# cd /usr/local/src/

root@server [~]# wget http://www.kernel.org/pub/linux/kernel/v2.6/
Select latest Kernel and download it

root@server [~]# tar –zxvf linux-2.6.28.tar.gz
root@server [~]#cd linux-2.6.28
root@server [~]# make clean
root@server [~]# make mrproper
root@server [~]# uname -r
root@server [~] # cp /boot/config-’uname -r’ .config
root@server [~] # make oldconfig
root@server [~] # make menuconfig
root@server [~] # make
root@server [~] # make modules_install
root@server [~] # make install
root@server [~] # grubby –bootloader-probe
root@server [~] # pico /etc/grub.conf
Change the default as per the entry for your new kernel.
root@server [~]# reboot

 

Some time after reboot server it won’t up and running with the new kennel due to that before rebooting server, make following

changes.

root@server [~]#grub

Above command will give you grub prompt.

grub > savedefault –default=0 –once

grub>quit

root@server [~]#reboot

If server is up and running after reboot you can set new kernel as default server in grub.conf file.

root@server [~]#pico /boot/grub/grub.conf

Set

default=1

to

default=0

 

Disable php for single hosting account.

We can disable the php for single hosting account by using following code in .htaccess file.

php_value engine off

 

How to delete frozen emails?

You can delete the frozen emails by using the following command from shell but make sure that you have logged in as a root user.

exim -bp | awk ‘$6~”frozen” { print $3 }’ | xargs exim -Mrm

 

Add SPF record by default for all new accounts domain

If anyone want to add SPF record by default to newly created account on cPanel server then follow the steps one by one to enable the SPF record.

1. Login to WHM using root
2. Click on Edit “Zone Templates” and then on “standard”
3. Add at the end of the “Zone Templates” file:

%domain%. IN TXT “v=spf1 a mx -all”

You can replace “v=spf1 a mx -all” with the syntax which you want set for your domains
.
4. Repeat step no 2 and 3 respectively for the “simple” zone template.

 

Send mail by using phpmail function.

You can create a simple php mail form by using following code..

————————–

<?
$to      = ‘supp0rt@xyz.com’;
$subject = ‘The test for mail function’;
$message = ‘Hello’;
$headers = ‘From: test@abc.com’ . “\r\n” .
‘Reply-To: test@testforever.com’ . “\r\n” .
‘X-Mailer: PHP/’ . phpversion();
mail($to, $subject, $message, $headers);
?>

————————–

If you are not able to receive the E-mail then you need to check whether your server is allowing to send an E-mail by using phpmail() or not?’ if you are having root login then check the servers main php.ini file.

root@server []# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

root@server []# cat /usr/local/lib/php.ini | grep disable_function
disable_functions=”system,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,highlight_file,phpmail”

and remove the phpmail() from server mail php.ini file and restart the Apache web server.

Or

If you are not having root login details then contact your hosting provider and ask them to enable the phpmail() for your hosting account.

You can also send me an E-mail at nsk.gunjan@gmail.com if you have any queries…

 

 

How to enable html display for horde?

You can enable the html display for horde by using following steps but please make sure that you have been logged in as root.

root@admin[~]# vi /usr/local/cpanel/base/horde/imp/config/mime_drivers.php

Search for the line
—-
/**
* HTML driver settings
*/
$mime_drivers[‘imp’][‘html’][‘inline’] = false;
—–

and replace it with

——–
/**
* HTML driver settings
*/
$mime_drivers[‘imp’][‘html’][‘inline’] = true;

——–
Save the changes and restart the following services.
root@admin[~]#service cpanel restart
root@admin[~]#/scripts/restartsrv_courier

 

How to disable local-mail delivery for one domain name?

You can disable local-mail delivery for one  domain name from your shell and follow the instructions..

First go to file
root@admin[~]#vi /etc/localdomains
Then select the domain name give them comment# or remove it and save the file
:wq!

Second step go to file
root@admin[~]#vi /etc/remotedomains
and add the domain name we have comment or removed in the above file
:wq!

Basically when ever we use external mail server at that time we need to remove domains entry from /etc/localdomains file and add it in /etc/remotedomains file.