2

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?

dvdsmpsn
  • 436

3 Answers3

2

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.
dvdsmpsn
  • 436
0

Edited (as requested):

@dvdsmpsn's answear (the answear to his own question in fact) is very good, but did not work for me completely. I am using a Windows 7 host and an Ubuntu 16.04 guest. Although the systems were different, the problem was the same.

Someone in different conditions, like mine, may not be able to make the connection work.

I had to use the knowledge from those answears too:

https://serverfault.com/questions/421161/how-to-configure-vsftpd-to-work-with-passive-mode

@brain99's observation about the pasv_address=xxx.xxx.xxx.xxx was very important. It did not work for me without it.

Ubuntu server (guest VM):

My Ubuntu server has vsftpd as the FTP server. To make it work in passive mode, I had to add this at the end of my vsftpd.conf (inside the /etc folder -- you can use the search function if you are using a window manager):

pasv_enable=YES
pasv_min_port=8020 # like @dvdsmpsn recommended
pasv_max_port=8020 # like @dvdsmpsn recommended
pasv_address=127.0.0.1 # added like @brian99 recommended, BUT I used the localhost address.

I used the localhost address because my virtual machine does not have a public IP address.

Only for testing, I disabled UFW (my firewall). I did not want anything make an already complicated problem even worse.

As the user @Martin Prikryl points out in his answear:

Connection to FileZilla FTP server works, but directory listing fails

FTP uses two ports. So, we are going to port forward two ports in VirtualBox.

Windows 7 (host):

After making the FTP server work in passive mode, I followed @dvdsmpsn directions:

  1. In VirtualBox > VM settings > NAT > advanced > Port Fowarding I added two entries:

    Host Port 8021 to Guest Port 21 Host Port 8020 to Guest Port 8020

  2. Restart the VM

I tested this setup in FileZilla and Dreamweaver. It worked without problems in passive mode in both applications.

Unfortunatelly, the references mentioned don't say anything about chroot the users. My Ubuntu guest is running Apache web server and I need to jail them to their own /home/$user directories.

0

As of VirtualBox 6.0.0 (released December 18 2018) Virtual Box now has Drag & Drop support between the host and the guest OS.

I have just installed it and used it. It does work quite nicely - although you do need to have the Guest Additions package installed - and that can be a futzy nightmare. I never managed to get the Debian image I have working. I did manage to get ubunutu going pretty smoothly. After installing the Guest Additions, I needed to do a restart of the guest.

Then "Bob's your Uncle!"

kiltannen
  • 113