title: configure proftpd to serve ftp and sftp simultaneously
body: <p>Using Ubuntu 18.04 LTS and ProFTPD 1.3.5e.</p>
  
  <p>I have ProFTPD serving FTP on ports 20, 21 and running just fine.</p>
  
  <p>When I add in /etc/proftpd/conf.d/sftp.conf, FTP quits working.  When I delete the sftp.conf and restart proftpd, FTP starts working again.  I conclude that there is something wrong with this conf file.</p>
  
  <p>Also, I want sftp to accept just a login id and password for authentication.  How do I do that?  I have looked at the SFTPAuthMethods directive and it looks like if I leave it out then it will allow all authentication methods and that is okay with me.</p>
  
  <p>Here is the sftp.conf file:</p>
  
  <pre><code>&lt;IfModule mod_sftp.c&gt;
  
          SFTPEngine on
          Port 2222
          SFTPLog /var/log/proftpd/sftp.log
  
          # Configure both the RSA and DSA host keys, using the same host key
          # files that OpenSSH uses.
          SFTPHostKey /etc/ssh/ssh_host_rsa_key
          SFTPHostKey /etc/ssh/ssh_host_dsa_key
  
          SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u
  
          # Enable compression
          SFTPCompression delayed
  
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>What should I change to get SFTP running on port 2222 and continue to have FTP running on ports 20 &amp; 21?</p>
  
  <h2>Thanks in advance!</h2>
  
  <p>Update:</p>
  
  <p>Based on the excellent feedback I have received in the notes, instead of using the sftp.conf file I have above, I added a  wrapper and some other configuration parameters and have put that config into the proftpd.conf file.  It reads as follows:</p>
  
  <pre><code>&lt;snip&gt;
  
   &lt;IfModule mod_sftp.c&gt;
      &lt;VirtualHost 0.0.0.0&gt;
        # The SFTP configuration
  
          SFTPEngine on
          Port 2222
          SFTPLog /var/log/proftpd/sftp.log
          Include /etc/proftpd/sql.conf
  
          SFTPAuthMethods password keyboard-interactive hostbased publickey
  
          # Configure both the RSA and DSA host keys, using the same host key
          # files that OpenSSH uses.
          SFTPHostKey /etc/ssh/ssh_host_rsa_key
          SFTPHostKey /etc/ssh/ssh_host_dsa_key
  
          SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u
  
          # Enable compression
          SFTPCompression delayed
      &lt;/VirtualHost&gt;
    &lt;/IfModule&gt;
  </code></pre>
  
  <p>So now the server is answering on FTP ports normally and on port 2222.  When I attempt to connect to port 2222 using WinSCP, it fails authentication. Here is the sftp.log file snipped that is generated each time I try to connect.  </p>
  
  <pre><code>2020-04-21 21:03:50,340 mod_sftp/0.9.9[13017]: sent server version 'SSH-2.0-mod_sftp/0.9.9'
  2020-04-21 21:03:50,355 mod_sftp/0.9.9[13017]: received client version 'SSH-2.0-WinSCP_release_5.17.3'
  2020-04-21 21:03:50,355 mod_sftp/0.9.9[13017]: handling connection from SSH2 client 'WinSCP_release_5.17.3'
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session key exchange: ecdh-sha2-nistp256
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session server hostkey: ssh-rsa
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session client-to-server encryption: aes256-ctr
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session server-to-client encryption: aes256-ctr
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session client-to-server MAC: hmac-sha2-256
  2020-04-21 21:03:51,284 mod_sftp/0.9.9[13017]:  + Session server-to-client MAC: hmac-sha2-256
  2020-04-21 21:03:51,285 mod_sftp/0.9.9[13017]:  + Session client-to-server compression: none
  2020-04-21 21:03:51,285 mod_sftp/0.9.9[13017]:  + Session server-to-client compression: none
  2020-04-21 21:03:51,957 mod_sftp/0.9.9[13017]: sending acceptable userauth methods: password,keyboard-interactive,hostbased,publickey
  2020-04-21 21:03:52,302 mod_sftp/0.9.9[13017]: expecting USER_AUTH_INFO_RESP message, received SSH_MSG_IGNORE (2)
  2020-04-21 21:03:52,322 mod_sftp_pam/0.3[13017]: PAM authentication error (7) for user 'test': Authentication failure
  
  
  </code></pre>
  
  <p>For FTP, I am authenticating successfully from a MySQL database.  But the last line of the sftp.log file says that PAM authentication failed for my SFTP attempt.  I am just trying to authenticate in the WinSCP client with a login and password that come from MySQL.  Does that involve PAM authentication?</p>
  
  <p>I think I am getting close!</p>
  
  <p>Thanks in advance! </p>