Ftp: 425 Unable to build data connection

October 16, 2009    |   Posted by admin   |    Category: Linux Administration

Error Message:

LIST
425 Unable to build data connection: Connection timed out
PASV
227 Entering Passive Mode (xx,xx,xx,xx,xx,xxx).
connecting data channel to xx.xxx.xx.xxx:54963

The above error message is received while you Ftp to an account successfully but it does not list the files and directories within it. The reason for the error message is, the kernel modules that are required for Ftp “i.e. to keep track of every Ftp connection and carry out the data transfer of it on another port” is not loaded.

The modules are “ip_conntrack” and “ip_conntrack_ftp” which has to be loaded using the ‘modprobe’ command.

SSH to your server as user root and execute the following commands:

# /sbin/modprobe ip_conntrack
# /sbin/modprobe ip_conntrack_ftp

To verify if the modules are loaded properly, execute

# lsmod | grep ftp

This should list the modules you just loaded. Once they appear, ftp should list the files/directories on successful login.

Comments Off on Ftp: 425 Unable to build data connection

Howto: deny/allow IP using iptables

October 16, 2009    |   Posted by admin   |    Category: Linux Administration

How to block an IP using iptables?

iptables -A INPUT -s xx.xx.xx.xx -j DROP

How to block an IP for a specific port:

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP

How to allow access to an IP?

iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

How to allow access to an IP to a specific port using iptables?

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT

where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow/deny access to.

How to block a scanner on your server for example “w00tw00t.at.ISC.SANS” using iptables?

iptables -I INPUT -p tcp --dport 80 -m string --algo bm  \
--string 'GET /w00tw00t.at.ISC.SANS.' -j DROP
Comments Off on Howto: deny/allow IP using iptables

How to upgrade PHP on a Plesk server?

October 13, 2009    |   Posted by admin   |    Category: Plesk Management

How to upgrade PHP on a Plesk server? You will have to download a script from ww.atomicorp.com and have to install it which will then allow you to upgrade PHP using yum.

1) Download the script:

wget -q -O – http://www.atomicorp.com/installers/atomic.sh

2) Install the script:

sh atomic.sh

3) Now upgrade PHP using yum:

yum upgrade php

Once it is installed, restart the httpd service.

Comments Off on How to upgrade PHP on a Plesk server?

Howto: Re-create/re-install a VPS

October 13, 2009    |   Posted by admin   |    Category: VPS Management

How to re-create/re-install a OpenVZ VPS?

1) Make a backup of the configuration file:

cp -p /etc/sysconfig/vz-scripts/VEID.conf  /etc/sysconfig/vz-scripts/VEID.conf_old

2) Stop the VPS:

vzctl stop VEID

3) Destroy/Terminate the VPS:

vzctl destroy VEID

4) Create the VPS using the OS templates stored under /vz/template/cache directory:

vzctl recreate VEID –ostemplate os-template-name

5) Copy the original configuration file back to have the original parameters:

cp -p /etc/sysconfig/vz-scripts/VEID.conf_old /etc/sysconfig/vz-scripts/VEID.conf

6) Start the VPS and reset the password

vzctl start VEID
vzctl set VEID –userpasswd root:password –save

Comments Off on Howto: Re-create/re-install a VPS

Howto: enable HTTP Compression

October 10, 2009    |   Posted by admin   |    Category: Linux Administration

How to enable HTTP Compression? In order to enable compression, you will need compression modules compiled with Apache. Apache 1.x needs mod_gzip and Apache 2.x need mod_deflate compiled with it.

If  you have these module installed, you need to edit your Apache configuration file locate at “/etc/httpd/conf/httpd.conf” file and add the following lines to it:

<Location />
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI  \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
</Location>

Save the file and restart the httpd service. This will compress all the files except the .gif, .jpe, .jpeg and .png files.

Related URLs:
How to enable http compression on a Plesk server?