FTP from my Linux server isn't working

madaboutlinux

Well-Known Member
Jan 24, 2005
1,051
2
168
Earth
This issue is driving me crazy from yesterday. Pure-Ftp on my VPS is working fine. I can connect to my server via Ftp from outside, however I cannot connect to 'localhost' or any remote server from my vps. It says

[email protected] [~]# ftp localhost
ftp: connect: Connection refused
ftp>
Same message even if I try to connect to a remote server.

Ftp is not running as xinetd, infact xinetd is completely stopped on my server.

Firewall is also not an issue, since I disabled it completely and tested.

The "bind" directive in pure-ftpd.conf is by default commented and should allow all connections.

I even removed Ftp from the VPS completely and reinstalled it again with no luck.
 

Miraenda

Well-Known Member
Jul 28, 2004
243
5
168
Coralville, Iowa USA
cPanel Access Level
Root Administrator
Could you provide the output for the following:

Code:
lsof -i :21
netstat -an|grep :21
Also, if you are using iptables or anything for a firewall, please check in it for anything relating to port 21:

Code:
/sbin/iptables -n -L --line-number|grep :21
 

cPanelKenneth

cPanel Development
Staff member
Apr 7, 2006
4,607
79
458
cPanel Access Level
Root Administrator
Yes, I have already checked it with lsof and netstat as well and the port is listening. And as said earlier, I even checked it by disabling the firewall.

I can connect to my server using Ftp from outside but not from within the VPS either to localhost OR any remote server.
Try using telnet:

Code:
[email protected] [~]# telnet localhost 21
Trying 127.0.0.1...
Connected to localhost (127.0.0.1).
Escape character is '^]'.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 15:27. Server port: 21.
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Can you connect to the IP address? (i.e. ftp 127.0.0.1)
 

rackaid

Well-Known Member
Jan 18, 2003
89
28
168
Jacksonville, FL
cPanel Access Level
DataCenter Provider
Try ...

Code:
ping localhost
If this fails, then I suspect a DNS issue.

You will want to update your /etc/hosts file with:

Code:
127.0.0.1       localhost.localdomain localhost
Then try,

Code:
ping localhost
If it resolves, then you should be able to use your FTP.
 

madaboutlinux

Well-Known Member
Jan 24, 2005
1,051
2
168
Earth
Try using telnet:
Can you connect to the IP address? (i.e. ftp 127.0.0.1)
Try ...

ping localhost
I have tried all these things before posting here :) which is why I am pulling my hairs. BTW, here's the output for you:

[email protected] [~]# telnet localhost 21
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 22:52. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.
[email protected] [~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=0 ttl=64 time=0.040 ms
64 bytes from localhost.localdomain (127.0.0.1): icmp_seq=1 ttl=64 time=0.045 ms
BTW, ftp to anything from my server doesn't work. See:

[email protected] [~]# ftp 127.0.0.1
ftp: connect: Connection refused
ftp>