How to Create a SFTP Server

The steps below are used to create an SFTP server on Ubuntu.

 

Download Ubuntu Desktop here
We prefer using Filezilla as our SFTP client which can be downloaded here

 

  1. Open Terminal (CTRL + ALT + T)
  2. sudo apt-get install openssh-server
  3. Stay in sudo mode by typing sudo -s
  4. groupadd sftponly
  5. useradd boris
  6. passwd boris
  7. Enter new password
  8. Retype new password
  9. usermod -G sftponly boris
  10. cat /etc/group
  11. mkdir -p /var/www/vusers/boris
  12. cd /var/www/vusers/
  13. ll (You should see the username listed)
  14. cd boris/
  15. mkdir incoming
  16. ll (You should see the incoming folder listed in the directory)
  17. chown boris incoming/
  18. ll (You should see boris and root have permissions over the incoming folder)
  19. usermod -d /var/www/vusers/boris/ boris
  20. cat /etc/passwd
  21. usermod -s /sbin/nologin boris
  22. cat /etc/passwd (boris will show /var/www/vusers/boris/:/sbin/nologin)
  23. usermod -s /bin/ false boris
  24. cat /etc/passwd (boris will now show /var/www/vusers/boris/:/bin/false)

  25. To summarize the steps we've just completed
    1. Created user
    2. Set Password for user account
    3. Created home directory
    4. Set permissions that root is the of main directory
    5. Created the SFTP Folder 'incoming'
    6. Set permissions that the owner is user 'boris'
    7. Changed the home directory using usermod
    8. Assigned boris /bin/false shellcd

  26.  vim /etc/ssh/sshd_config
  27. Text editor will open
  28. Find the Subsystem line
  29. Place # infront of Subsystem
  30. Create a new line underneath
  31. Type Subsystem sftp internal-sftp (It should look like the following below)

  32. #Subsystem sftp /usr/libexec/openssh/sftp-server
    1. Subsystem sftp internal-sftp

  33. Find a blank line at the bottom
  34. Enter the below as is
    1. #for chroot sftp
    2. Match Group sftponly
    3. ChrootDirectory %h
    4. ForceCommand internal-sftp
    5. X11Forwarding no

  35. Save the changes :wq!
  36. service ssh restart
    1. If that doesnt work just reboot the Ubuntu box using the restart command

  37. Test by using Filezilla by connecting to the Ubuntu IP or hostname using port 22 and the user credentials set.

 

As a Windows alternative, we have used and recommend JSCAPE MFT Server. 
JSCAPE MFT Server is a simple easy to use SFTP server with a GUI.
You can download it for free from here.

 

Please contact us here if you require any technical support.

JSCAPE MFT Server SFTP Ubuntu Windows

← Older Post Newer Post →



Leave a comment