Score:0

ProFTPd config via SFTP and FTP

de flag

I have a ProFTPd that actually use FTP protocol, but I would like to use SFTP too.
I found a solution with <VirtualHost> block, but it doesn't work for me.

  <IfModule mod_sftp.c>
      <VirtualHost 0.0.0.0>

        TLSEngine          off
        SFTPEngine         on
        Port               2222
        SFTPLog            /var/log/proftpd/sftp.log
        Include            /etc/proftpd/sql.conf

        SFTPHostKey        /etc/ssh/ssh_host_rsa_key
        SFTPHostKey        /etc/ssh/ssh_host_ecdsa_key

        SFTPCompression    delayed
        DefaultRoot        ~
        RequireValidShell  on

     </VirtualHost>
  </IfModule>


This is the output of the `/var/log/proftpd/sftp.log`

2021-10-11 11:03:32,289 mod_sftp/0.9.9[20791]: using '/etc/ssh/ssh_host_ecdsa_key' as 256-bit ECDSA hostkey
2021-10-11 11:03:32,289 mod_sftp/0.9.9[20791]: using '/etc/ssh/ssh_host_ecdsa_key' as 256-bit ECDSA hostkey
2021-10-11 11:03:32,291 mod_sftp/0.9.9[20791]: sent server version 'SSH-2.0-SFTP Server'
2021-10-11 11:03:32,291 mod_sftp/0.9.9[20791]: received client version 'SSH-2.0-PuTTYFileZilla_3.46.3'
2021-10-11 11:03:32,291 mod_sftp/0.9.9[20791]: handling connection from SSH2 client 'PuTTYFileZilla_3.46.3'
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session key exchange: ecdh-sha2-nistp256
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session server hostkey: ecdsa-sha2-nistp256
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session client-to-server encryption: aes256-ctr
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session server-to-client encryption: aes256-ctr
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session client-to-server MAC: hmac-sha2-256
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session server-to-client MAC: hmac-sha2-256
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session client-to-server compression: none
2021-10-11 11:03:32,363 mod_sftp/0.9.9[20791]:  + Session server-to-client compression: none
2021-10-11 11:03:32,504 mod_sftp/0.9.9[20791]: sending acceptable userauth methods: keyboard-interactive,password
2021-10-11 11:03:32,626 mod_sftp/0.9.9[20791]: expecting USER_AUTH_INFO_RESP message, received SSH_MSG_IGNORE (2)
2021-10-11 11:03:32,627 mod_sftp_pam/0.3[20791]: PAM authentication error (7) for user 'sql_user': Authentication failure
2021-10-11 11:03:32,627 mod_sftp/0.9.9[20791]: sending userauth failure; remaining userauth methods: keyboard-interactive,password
2021-10-11 11:03:32,628 mod_sftp/0.9.9[20791]: unhandled SSH_MSG_USER_AUTH_INFO_RESP (61) message, disconnecting
2021-10-11 11:03:32,628 mod_sftp/0.9.9[20791]: disconnecting (Unsupported protocol sequence)
drookie avatar
za flag
Don't. Use sftp from openssh installation. Proftpd is an abandonware.
so flag
@drookie Says who? ProFTPD is actively developed: https://github.com/proftpd/proftpd/commits/master – Its SFTP implementation is in many respects better than that of OpenSSH.
drookie avatar
za flag
Says the Universe. Good luck then.
Score:1
us flag

Correct. The solution to have your FTP Daemon works on both FTP/21 and SFTP/2222 is to have <VirtualHost 0.0.0.0> section inside of <IfModule mod_sftp.c>.

I'm sharing this part of my configuration file in /etc/proftpd/proftpd.conf which works fine.

<VirtualHost 0.0.0.0>
  
    SFTPEngine on
    Port 2222
    SFTPAuthMethods password
    RequireValidShell      off
    SFTPLog /var/log/proftpd/sftp.log
    Include /etc/proftpd/sql.conf

    SFTPHostKey /etc/ssh/ssh_host_rsa_key
    SFTPHostKey /etc/ssh/ssh_host_dsa_key
    
    SFTPCompression delayed
    DefaultRoot
</VirtualHost>
zeerk avatar
de flag
The `SFTPAuthMethods password` was missing from mine! Thank You so much!! :-)))
megamaiku avatar
wf flag
Sorry for the bump, but I am in the process of setting up SFTP access as well, but I think I'm missing something. I set up an FTP user (in Virtualmin/Webmin), enabled the modules, and entered the VirtualHost, but I still get access denied. I thought I was going to be able to omit having to use a key or that my key would be automatically accepted and then just use the FTP password I'd set up earlier. Am I missing something? Thanks in advance @zeerk & Zareh
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.