New FTP Command: HOST for Virtual Hosts

Demonstrates use of HOST command in FTP clients and servers.
  1. Blog

FTP originated at a time before virtual hosting, where multiple servers are hosted on a single IP address but with different domain names. On the Internet, multiple domain names may resolve to a single IP address.

The problem is that FTP servers recognize incoming FTP connections by their IP address, not their domain names. Different virtual hosts can't offer different authentication and file systems. With stock FTP, multiple domain names (for instance, ftp.example.com and ftp.example2.com) that are hosted on a single IP address will have the same authentication and file systems.

Enter the FTP HOST command, which is being finalized as an RFC in the new FTP Working Group. HOST is used to determine which virtual hosts, of possibly many, the client wishes to connect. The FTP client uses HOST to specify which domain name it is attempting to connect to. (This is similar to HTTP/1.0, where HTTP/1.1 added the Host header field to alleviate the situation). HOST should be used before the user is authenticated.

Here's an example of HOST in use, with C> and S> respectively representing the client and server. In it, the client is stating that it wants to use the server with a particular domain name (ftp.example.com).

C> HOST ftp.example.com
S> 220 Host accepted
C> USER foo
S> 331 Password required
C> PASS bar
S> 230 User logged in

HOST has been in use for a while, but had been informally specified. HOST already has a number of implementations such as Microsoft's IIS FTP service, which the author of HOST works on. Hopefully with an Internet standard that describes HOST, it will be seen as more reliable, stable, and consistently implementable.