April 3, 2012

Change the time zone for a domain on shared server

Filed under: Miscellaneous — admin @ 3:30 am

You can change the time zone for a particular domain via .htaccess or php.ini file. If the server PHP is compiled with apache (dso) then you can use .htaccess file to set the time zone.
==================
SetEnv TZ location
==================

For SuPHP servers, you can create custom php.ini file for that particular domain and add the following code.
===========================
date.timezone = “location”
===========================

AddThis Social Bookmark Button

How to install CSF

Filed under: Miscellaneous — admin @ 2:53 am

You can install CSF by downloading the package from www.configserver.com.

#wget www.configserver.com/free/csf.tgz

Extract the package

#tar -zxvf csf.taz
#cd csf

[CSF firewall requires to remove any currently running IP based firewall]

If any IP based firewall is running. Remove it

#./remove_apf_bfd.sh

Install script

#./install.sh

we can start the firewall in testing mode using this commands.

#csf -s
//start the firewall

Configuration file of csf is /etc/csf/csf.conf

It is very important to check the firewall on which ports to open and close all remaining port numbers. Open the /etc/csf/csf.conf and edit the following line with port numbers.

#Incoming TCP ports
TCP_IN = “20,21,22,25,53,80,110,143,443,953,993,995,2082,2083,2087,2086.2089″
# Allow outgoing TCP ports
TCP_OUT = “20,21,22,25,37,43,53,80,110,443.953,2087,2089″
#Incoming UDP ports
UDP_IN = “20,21,53,953″
#Outgoing UDP ports
UDP_OUT = “20,21,53,113,123,953”

Disable the Testing mode and start the firewall

AddThis Social Bookmark Button

March 25, 2012

Commenting multiple lines in a shell script using vi/vim in a single step

Filed under: Miscellaneous — admin @ 2:03 am

A text editor like vi or vim can be used to comment multiple lines in a shell script (or any other scrip or configuration file) in a single go rather than adding # or whatever that goes for a comment for the script in question.

Open the file to be edited using vi/vim using the command vi filename (where filename can be replaced by the name of the file), now enter the command mode by pressing : .In order to comment multiple lines ( i.e. to add a # to the beginning of the line) , say lines from 5 to 10 in the script, type the command
:5,10s/^/#/ # : in the command is part of entering the editing/ex mode in vi.

Note# The command :set nu can be used to view line numbers in vi/vim
Clarification
General Syntax
==============================================
:%s/r1/r2/ is the syntax used for string substitution in vi/vim
Syntax split
: Enter command mode
% Perform the command on all lines
s Short form for :substitute command
r1 Can be replaced with any string in the script/file that is to be replaced
r2 Can be replaced with any string which should replace the string r1 in the script/file
/ Used a separator
Changes from syntax in executed command
============================================

In the command that we used for substitution/adding comments to lines starting from 5 to 10
% has been replaced with 5,10 so that the command will be executed only for lines starting from 5 to 10
^ caret [^ ] matches the position before the first character in the string (hence in the command that we executed the substitution takes place for the “position before the first character”[=r1])
# Replacement for r2 in syntax (i.e. # is used as the character/string which substitutes r1[“position before the first character”])

Comment removal

In order to uncomment multiple lines (we will remove # from the lines that we have commented, i.e. from 5 to 10) we can use the command
:5,10s/^#//
Clarification
^# Matches all characters starting with # (since ^ means position before the first character, ^x [x can be replaced with any character which does not hold a special meaning in bash, or \x if x has got a special meaning] will match any line which has got x as the character at the first character)
// Two /s without any in between space :: hence substitution will completely remove # from the beginning without adding anything
Commenting all lines in a script/file
Open the file in vi/vim and use the command
:%s/^/#/g

g stands for global (so that the substitution will occur globally, i.e. for all lines in the script)
All the rest have already been explained in “General Syntax”
Note: For php files which treat ; as the commenting character instead of # , # can be replaced with ; i.e. for commenting all lines in a php file we can use the command %s/^/;/g

AddThis Social Bookmark Button

March 23, 2012

Tracked?

Filed under: Miscellaneous — admin @ 11:26 pm

Privacy is everybody main concern especially while using the internet. Would you like to be tracked? Everyone would have the answer “NO”. Therefore, here is a solution in the form of a plugin/add-on. Best of all; it is FREE. Its compatible with Windows, Linux and even Mac. Currently it is available for the browsers: Chrome, Firefox, Safari, and Internet Explorer. The number of companies that are tracking you would surprise you. You would no longer have to worry about the ever-changing piracy policies.

Check out this video:

You can download it from here

Article Authored by Rosemary J Thomas
Author, Rosemary J Thomas, is the Business Development Executive with SupportPRO.
SupportPRO offers 24X7 technical support services to Web hosting companies and service providers.

AddThis Social Bookmark Button

March 11, 2012

Re-Route SMTP Via IP Tables

Filed under: Miscellaneous — admin @ 12:34 am

Consider a situation where the email server ip gets blacklisted in a server with any email server like exim or qmail, we can reroute the smtp via another IP using IP Tables.

For routing the SMTP via xxx.xxx.xx.xx, issue the following command:

iptables -t nat -A POSTROUTING -o eth0 -p tcp –dport 25 -j SNAT –to xxx.xxx.xx.xx

AddThis Social Bookmark Button
Next Page »

Powered by WordPress