Make FTP Server on virtualbox work in passive mode

5,948

Solution 1

I made it work via the following:

  1. I forwarded all of the passive ports from the main OS to the guest OS
  2. I masked the IP of the FTP server to 127.0.0.1

I posted about it on my blog for a more definitive explanation.

Solution 2

FTP uses two connections, one for data and one for commands. The PassivePorts configuration is the range of ports to be used for passive FTP data transfers.

The Virtualbox network configuration allows you to enter single ports to forward, but not ranges. So, in order for passive-mode FTP to work, the passive ports must be forwarded individually.

If you don't expect more than 5 simultaneous data transfers (and clients like Filezilla will open 1 data connection per file and per directory listing) then change the server configuration to use a range of 5 ports (e.g. 1025-1030) and forward those five ports in the Virtualbox configuration. For 10 connections use a 10 port range, etc.

Share:
5,948

Related videos on Youtube

kapitanluffy
Author by

kapitanluffy

Updated on September 18, 2022

Comments

  • kapitanluffy
    kapitanluffy over 1 year

    I have an ubuntu server installed on a virtual box. I installed proftpd in it and forwarded the port 21 (ftp port) from the network settings of the virtual box.

    The problem is the ftp client is using passive mode. I checked the proftpd.conf and un-commented the PassivePorts configuration which are 49152 and 65534. but still the FileZilla cannot retrieve the directory listing. I made it work using the active mode but i wanted it to use the passive mode.

    08:25:25 Error: Connection timed out

    08:25:25 Error: Failed to retrieve directory listing

    UPDATE --

    I tried forwarding all passive ports configured on the proftpd.conf (from 65500-65534) the ports are opened in the main OS. the guest OS doesnt have any opened ports yet. when i create an ftp connection, i rechecked the opened ports in the guest OS and saw that some ports within that range are opened though the problem still persists..

    have been reading this..

    http://www.mdjnet.dk/ftp.html

    and i think the Port Forwarding in Virtualbox is quite limited. Are there any other ways where you can make the guest OS open ports dynamically to the main OS without the need of configuring it everytime?

    example scenario

    1. guest os started ssh server thus opening port 22
    2. vbox opens port 22 to main Os as well (as long as there are no conflicts.)
  • kapitanluffy
    kapitanluffy about 11 years
    i already did forwarded all the ports :)