To follow this tutorial, you will need:
- One Ubuntu 22.04 server set up with this initial server setup tutorial, including a sudo non-root user and a firewall.
$ sudo adduser ftpuser
$ sudo mkdir -p /var/sftp/uploads
$ sudo chown root:root /var/sftp
$ sudo chmod 755 /var/sftp
$ sudo chown ftpuser:ftpuser /var/sftp/uploads
sudo vi /etc/ssh/sshd_config
Scroll to the very bottom of the file and append the following configuration snippet:
Match User ftpuser
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp
PermitTunnel no
AllowAgentForwarding no
AllowTcpForwarding no
X11Forwarding no
$ sudo systemctl restart sshd
$ sftp ftpuser@localhost