For Linux and Shell scripting.

FTP not working….. Connection closed by foreign host.

Leave a comment

My FTP service is not working. When I try telneting to ftp port, it gets closed by foreign host soon after connecting.

-bash-3.1# telnet localhost 21
Connected to localhost (
Escape character is ‘^]’.
Connection closed by foreign host.

The server is having Plesk control panel installed. So, ftp service is proftp which is started with xinetd. So, restarted xinetd and check if ftp is listening on port 21.

-bash-3.1# netstat -plan |grep 21
tcp 0 0* LISTEN 2173/xinetd
tcp 0 0* LISTEN 3221/httpsd
tcp 0 0* LISTEN 2173/xinetd
tcp 0 0* LISTEN 2173/xinetd

Yes, it’s listening and xinetd didn’t show any errors. But, still FTP connection is in the old stated……Connection closed by foreign host.

Just check /etc/xinetd.d/ftp_psa to see how ftp service is getting started and started it manually. Hmm…….it shows errors now :(.

root@~#/usr/sbin/in.proftpd -c /etc/proftpd.conf
– IPv4 getaddrinfo ‘’ error: Name or service not known
– warning: unable to determine IP address of ‘’
– error: no valid servers configured
– Fatal: error processing configuration file ‘/etc/proftpd.conf’

The hostname entry “” was missing in /etc/hosts.
root@~#hostname -i
hostname: Unknown host

So, added “” to /etc/hosts and restarted xinetd service. That resolved the issue.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s