Skip to main content

ProFTPd and SFTP

Ubuntu 22.04

  1. Install proftpd-basic
  2. Edit /etc/proftpd/modules.conf and enable mod_sftp and mod_sftp_pam
  3. Edit /etc/proftpd/sftp.conf (see example below)
  4. Edit /etc/proftpd/proftpd.conf and enable the sftp.conf include
  5. Create sftproot folders in user home directories as needed (based on the configuration shown below)
  6. You should be ready to rock and roll!
# mod_sftp is part of proftpd-basic, not proftpd-core
apt install proftpd-basic

 

<IfModule mod_sftp.c>
SFTPEngine     on
Port           2222
SFTPLog        /var/log/proftpd/sftp.log
#
# Configure all 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
SFTPHostKey /etc/ssh/ssh_host_rsa_key
SFTPHostKey /etc/ssh/ssh_host_ecdsa_key
SFTPHostKey /etc/ssh/ssh_host_ed25519_key

#SFTPAuthMethods publickey
#SFTPAuthMethods keyboard-interactive
SFTPAuthMethods publickey keyboard-interactive
SFTPAuthorizedUserKeys file:/etc/proftpd/authorized_keys/%u

#
# Use either
#    ssh-keygen -e -f ~user/.ssh/id_rsa.pub >/etc/proftpd/authorized_keys/user
# or
#    ssh-keygen -e -f ~user/.ssh/authorized_keys >/etc/proftpd/authorized_keys/user
# to convert users public keys in RFC4716 format.
#
#
# Enable compression
#
#SFTPCompression delayed

# Other desired configuration options
DefaultRoot ~/sftproot
RequireValidShell off
SFTPPAMOptions NoTTY NoInfoMsgs NoRadioMsgs
Umask  006 007

# Limit logins to only a specific group
<Limit LOGIN>
  AllowGroup sftponly
  DenyAll
</Limit>

</IfModule>

#end