Using VirtualHosts on a ProFTPd server   Recently updated !


When using ProFTPd you may want to have the server listening on different ports, for example if you want to use FTP and SFTP at the same time. Here is an example:

<VirtualHost 0.0.0.0 ftp.example.net>
        SFTPEngine off
        Port 21
	DefaultRoot ~
	Umask                           022  022
	AllowOverwrite                  on
</VirtualHost>

<VirtualHost 0.0.0.0 sftp.example.net>
        SFTPEngine on
        Port 2222
        SFTPLog /var/log/proftpd/sftp.log
        SFTPHostKey /etc/ssh/ssh_host_rsa_key
        SFTPHostKey /etc/ssh/ssh_host_dsa_key
        SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u
        SFTPCompression delayed
        SFTPAuthMethods publickey
	DefaultRoot ~
	Umask                           022  022
	AllowOverwrite                  on
</VirtualHost>

You can simple put those vhosts in 2 files ftp.conf and sftp.conf as an example into /etc/proftpd/conf.d/. Don't forget to restart the service: service proftpd restart

You can make your Virtualhost listen to any IPv4 address (0.0.0.0), IPv6 included (::0.0.0.0), a specific one or a hostname. In this case it listens on all IPs, using the hostname ftp.example.net respectively sftp.example.net.

For configuring SFTP correctly, have a look at Installing ProFTPd with Public Key Authentication on Ubuntu 16.04‚Äč