Problems with FTP file access to VirtualBox guest running Windows 2008 Server R2 x64

I'm on OSX 10.11 and have a VirtualBox guest running Windows 2008 Server R2 x64 (with NAT networking) running IIS with FTP on port 21.

My problem is: I can login to FTP from the host, but can't see directory listings or get files.

FTP was installed like this and there is a Windows firewall entry allowing TCP over port 21.

Port 21 on the guest is forwarded to port 8021 on the host. Login to the guest on FTP is successful, but I can't view any of the files using FTP.

On the host: Using command line to FTP, I get this:

$ ftp localhost 8021
Trying ::1...
ftp: Can't connect to `::1': Connection refused
Trying fe80::1%lo0...
ftp: Can't connect to `fe80::1%lo0': Connection refused
Trying 127.0.0.1...
Connected to localhost.
Name (localhost:david): Administrator
331 Password required for Administrator.
Password: ****
230 User logged in.
Remote system type is Windows_NT.
ftp> dir
229 Entering Extended Passive Mode (|||49170|)
ftp: Can't connect to `127.0.0.1': Connection refused
501 Server cannot accept argument.
150 Opening ASCII mode data connection.
ftp: Poll timeout waiting before accept
425 Cannot open data connection.


^C
421 Service not available, user interrupt. Connection closed.
ftp> quit

Using Transmit to FTP, the error message is:

Could not retrieve file listing for “/”. Server said: Server cannot accept argument.

Error -162: PORT failed

On the guest: Command line FTP works fine...

C:\Users\Administrator>ftp localhost
Connected to XXX.
220-Microsoft FTP Service
User (XXX:(none)): Administrator
331 Password required for Administrator.
Password: *****
230 User logged in.
ftp> dir
200 EPRT command successful.
125 Data connection already open; Transfer starting.
06-22-16  10:42AM       <DIR>          contracts
05-25-16  02:35PM               184946 welcome.png
226 Transfer complete.
ftp: 356 bytes received in 0.00Seconds 356000.00Kbytes/sec.
ftp>

Is there anything obvious I've missed? What next steps should I perform to get FTP working?


Solution 1:

OK, I figured this out. I enabled IIS to work in passive mode

On the Windows guest VM:

  1. Click Start and navigate to Administrative Tools->Internet Information Services (IIS) Manager
  2. Select the IIS server general settings page.
  3. Open the FTP Firewall Support feature and add your port range (I added 8020-8020) for passive mode then click Apply

On the host:

  1. In VirtualBox, select the virtual machine and go to Networking
  2. Add port forwarding for the extra FTP passive mode port. Forward from port 8020 on the guest to port 8020 on the host.
  3. Restart the virtual machine.

I now get the following result when using FTP from the host:

$ ftp localhost 8021
Trying ::1...
ftp: Can't connect to `::1': Connection refused
Trying 127.0.0.1...
Connected to localhost.
220-Microsoft FTP Service
Name (localhost:david): Administrator
331 Password required for Administrator.
Password: ****
230 User logged in.
Remote system type is Windows_NT.
ftp> dir
229 Entering Extended Passive Mode (|||8020|)
125 Data connection already open; Transfer starting.
06-22-16  10:42AM       <DIR>          contracts
05-25-16  02:35PM               184946 welcome.png
226 Transfer complete.