WRITELOOP

INSTRUCTIONS TO SETUP AN SFTP SERVER ON UBUNTU

2021 November 19

Setup sftp server on Ubuntu

The instructions below were tested with Ubuntu 20.04.

  • Edit /etc/ssh/sshd_config, adding lines below to the end of the file:
Match group sftp
ChrootDirectory /home
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
  • Restart ssh daemon: sudo systemctl restart ssh
  • Create a new user group called sftp. All of our SFTP users will need to belong to this group: sudo addgroup sftp
  • Create new user, and add it to the sftp group: sudo useradd -m sftpuser -g sftp
  • Set password for the new user: sudo passwd sftpuser
  • Set permissions for the new user home: sudo chmod 700 /home/sftpuser/
  • Restart the ssh daemon, or the server. reference: https://linuxconfig.org/how-to-setup-sftp-server-on-ubuntu-20-04-focal-fossa-linux