Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
    
That's what I was starting to wonder. Thanks. – Jason Oct 10 '12 at 12:39

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.

share|improve this answer
    
wow wow !! Such an honor here! But seems your doc is outdated : proftpd.org/docs/howto/Vhost.html . Anyway, I will do some more research why it is still not working for me (on webmin/ubuntu) – Pham Huy Anh 30 mins ago
    
Guys, I got this. My ProFTPD is 1.3.5, upgrade is one the way. Castaglia, you are awesome – Pham Huy Anh 26 mins ago
1  
Thanks! I've just filed an issue to get that doc updated. – Castaglia 19 mins ago
    
Cool, I hope the stable release could be available soon (including ubuntu repo). SUPER DUPER! – Pham Huy Anh 12 mins ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.