2

I tried setting up a FTP Server on my Netbook, but I cannot connect to it. Now I wonder how can I figure out what I did wrong.

I have an Apache2 server running on it to use with the domain (domain.dnsdynamics.com), and I can connect to that. // Edit: I can go to http://domain.com, but not ftp://domain.com

What steps can I take to figure out what's going wrong?

Edit: the network is connected via a D-Link DIR-615 Router, under forwarded ports is 20 and 21, both forwarded to my netbook with static IP.

There is no firewall installed on the netbook.

I've tried connecting via Internet and from LAN.

I've tested via Chrome and FileZilla, both said no response. (Timeout for FileZilla, Page not found for Chrome). Going to the http:// works, ftp:// not

Edit2: I have been trying vsftpd, which seems to be the default FTP Server for Ubuntu

Edit3: the vsftpd.conf (without comments). Default version, I have made no changes to it so far.

listen=YES  
local_enable=YES  
dirmessage_enable=YES  
allow_writeable_chroot=YES  
use_localtime=YES  
xferlog_enable=YES  
connect_from_port_20=YES  
chroot_local_user=YES  
chroot_list_enable=YES  
secure_chroot_dir=/var/run/vsftpd/empty  
rsa_cert_file=/etc/ssl/private/vsftpd.pem
Zanna
  • 70,465
  • 1
    "...I can connect to that" can you connect or not? What software are you using to connect? Do you get any response or result? – Lucio Feb 03 '14 at 21:00
  • I've tested via Chrome and FileZilla, both said no response. (Timeout for FileZilla, Page not found for Chrome). Going to the http:// works, ftp:// not. – SinisterMJ Feb 03 '14 at 21:12
  • @SinisterMJ Please add some more info about your network setup: is there a router, was it configured accordingly, do you run a firewall solution on any of the ends. Are you trying to connect from inside the same network or from the internet? Also, try adding the info in the question and not in the comments. Thanks! – GnP Feb 03 '14 at 21:35
  • Which FTP server? – Xavier J Feb 03 '14 at 23:01
  • Can you please post the content of /etc/vsftpd.conf? – Evenbit GmbH Feb 04 '14 at 09:10

1 Answers1

5

First of all, make sure that vsftpd service is running using the following command:

sudo systemctl status vsftpd.service

If it isn't: sudo systemctl start vsftpd.service

Next, you'll need to make sure that you can connect to your ftp using your server itself (with the loopback):

ftp 127.0.0.1
[YOUR_USERNAME]
[YOUR_PASSWORD]

If your user has logged in, that means that the problem isn't coming from the vsftpd service itself. I'm guessing that it might be because of the FTP connection mode. There are two connection modes on FTP: Active Mode and Passive Mode. Here's a brief explanation of this two modes:

Active Mode:

1. Client connects to port 21 of server (Command Channel)

2. Server connects FROM port 20 to a port specified by the client (DATA)

Passive Mode:

1. Client connects to port 21 of server (Command Channel)

2. Client connects from random port to a port specified by the server (DATA)

ACTIVE MODE vs PASSIVE MODE

By default, FTP client applications use Passive Mode because it is more "secure". So, with this mode, the port forwarding of port 20 (DATA CHANNEL) is obsolete because the external client (Internet) is trying to connect to another port for the Data Channel. So, you'll need to switch to the Active Mode so that the Data Channel connection is done by the server (who uses the port 20 to send) rather than the client.

As the following picture shows, in FileZilla client, you can switch to Active Mode: FileZilla Active Mode

The ftp command uses by default the Passive Mode as well. To force it into Active Mode, you'll need to do the following:

ftp [YOUR_FTP_SERVER_IP]
passive

By doing so, the passive flag will be set to false and the Data Channel will use the Active Mode (if you do it again, it'll set it back to true). (Sources: https://www.tutorialspoint.com/unix_commands/pftp.htm https://serverfault.com/questions/152245/how-to-disable-passive-mode-in-linux-ftp-command)

I hope my explanations weren't too confusing...

Kian
  • 333