3

I have a webserver that we are giving a consultant FTP access to. For one domain hosted on that server he needs access to a "dev" directory and for a different domain hosted on that server he needs access to a different directory. I am trying to set this up with VirtualHosts, but I am having issues. Here is the VirtualHost bit of my proftpd.conf file:

<VirtualHost www.example2.com>
        ServerName  "Example 2"
        DefaultRoot /var/www/example2/dev
</VirtualHost>
<VirtualHost www.example1.com>
        ServerName  "Example 1"
        DefaultServer on
        DefaultRoot /var/www/example1
</VirtualHost>

When I FTP to either domain I always get the first VirtualHost, even if I FTP to the second domain.

Castaglia
  • 3,239
  • 3
  • 19
  • 40
Jason
  • 251
  • 4
  • 7

2 Answers2

9

Note that with the advent of RFC 7151, FTP now has a HOST command for supporting true name-based virtual hosts, just as the Host header does for HTTP 1.1.

And ProFTPD implements this HOST command as of the 1.3.6rc1 release. To use it, you can either simply use DNS names in your <VirtualHost> section, like so:

<VirtualHost mysite.example.com>

Or you can explicitly alias the virtual servers as needed:

<VirtualHost 1.2.3.4>
  ServerAlias mysite1.example.com
  ServerAlias ftp.example.com
  ...
</VirtualHost>

Hope this helps!

Full disclosure: I'm the author of ProFTPD.

Castaglia
  • 3,239
  • 3
  • 19
  • 40
  • wow wow !! Such an honor here! But seems your doc is outdated : http://www.proftpd.org/docs/howto/Vhost.html . Anyway, I will do some more research why it is still not working for me (on webmin/ubuntu) – Phung D. An May 06 '16 at 18:47
  • Guys, I got this. My ProFTPD is 1.3.5, upgrade is one the way. Castaglia, you are awesome – Phung D. An May 06 '16 at 18:50
  • 2
    Thanks! I've just filed [an issue](https://github.com/proftpd/proftpd/issues/281) to get that doc updated. – Castaglia May 06 '16 at 18:57
  • Cool, I hope the stable release could be available soon (including ubuntu repo). SUPER DUPER! – Phung D. An May 06 '16 at 19:04
0

FTP dosen't work like HTTP. There is no name based virtual hosts. Only IP based. If you need same user name but different directories you can use separate TCP ports for them or more than one IP.

RJS
  • 1,419
  • 9
  • 9