Posted on Leave a comment

Activate SSL/TLS on the SFTPGO web UI

In this post, I describe how to activate SSL/TLS encryption on the SFTPGO web admin UI with CERTBOT and enable auto-renewal of the certificates using a post-renewal hook shell script.

Certbot is a free tool to enable TLS 1.3 AES 128 SHA 256 HTTPS using Lets encrypt certificates.

In this setup guide, I mostly followed the official Certbot instruction for a snapd installation/other server and some of the instructions from here.

This is a follow-up post to Setting up a SFTPGO SFTP server on a Hetzner Ubuntu 20.10 server.

Install Certbot SSL/TLS encryption on the SFTPGO web UI

Install snap with apt

sudo apt install snapd

Install snap core

sudo snap install core; sudo snap refresh core

Make sure certbot is not already installed with apt

sudo apt remove certbot

Install certbot with snap

sudo snap install --classic certbot

Make a symlink between /snap/bin/certbot and /usr/bin/certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

Open port 80 in the firewall

Certbot creates a web server on port 80 when it generates the SSL/TLS certificates so I open port 80 in the firewall. SFTPGO is running on port 8080.

Hetzner firewall

Image of opening port 80 in the hetzner firewall

nftables firewall

To activate HTTP(S) on the nftables firewall I used in this post, you would uncomment these lines:

Allow HTTP(S).  
tcp dport { http, https } accept
udp dport { http, https } accept

Run Certbot

Certbot uses the domain name of your server. You can find it by doing a reverse domain lookup on your server IP address. You also need to give certbot an email address.

Link: mxtoolbox reverse domain lookup

sudo certbot certonly --standalone

Make the post renewal hook shell script and run it

This shell script copies the files to the SFTPGO SSL directory, changes the ownership of the certificates to the SFTPGO user and reloads SFTPGO (sends a SIGHUP) when certbot renews the certificates. SFTPGO will keep on running when it reloads.

Open the script in nano

sudo nano /etc/letsencrypt/renewal-hooks/post/

Copy and paste the script

You need to change the to the name of your server.

Github link for this script.

sudo cp /etc/letsencrypt/live/ /etc/sftpgo/ssl/
sudo cp /etc/letsencrypt/live/ /etc/sftpgo/ssl/
sudo chown -R sftpgo:sftpgo /etc/sftpgo/ssl
sudo systemctl reload sftpgo 
Image of the script pasted in nano

Make the shell script executable

sudo chmod 755 /etc/letsencrypt/renewal-hooks/post/ 

Run the script

cd /etc/letsencrypt/renewal-hooks/post/ 

Enable SSL/TLS https in the SFTPGO configuration file sftpgo.json

Edit the sftpgo.json configuration file with nano

sudo nano /etc/sftpgo/sftpgo.json

Enable_https from false to true

"enable_https": true,

Change certificate_file to /etc/sftpgo/ssl/cert.pem
Change certificate_key_file to /etc/sftpgo/ssl/privkey.pem

"certificate_file": "/etc/sftpgo/ssl/cert.pem",
"certificate_key_file": "/etc/sftpgo/ssl/privkey.pem",
image of the changed json file

Restart SFTPGO

sudo systemctl restart sftpgo
sudo systemctl status sftpgo
image of sftpgo status

Type in your server address in a web browser

The lock icon beside the address will be locked and SSL/TLS encryption is now active.

lock icon
sftpgo web page

Testing the certbot auto renewal process (optional)

Check the status of snap.certbot.renew.timer

Certbot installs a systemd timer called snap.certbot.renew.timer.

It runs twice every day to check if it is time to renew the certificates. (It will run the renewal every 90 days)

sudo systemctl status snap.certbot.renew.timer 

Run a forced renewal of the certificates

To check if everything works, you can run a forced renewal of the certificates. (Max 5 times a week).

sudo certbot renew --force-renewal

Type in your server address in a web browser

Check if it still works.

Posted on Leave a comment

Setting up a SFTPGO SFTP server on a Hetzner Ubuntu 20.10 server

SFTPGO can run SFTP with web client, FTP with TLS, and WebDAV, and you can easily configure virtual chrooted users via a web browser.

In this post, I set up SFTPGO SFTP on Ubuntu 20.10 on a Hetzner auction server with 14 TB of SFTP storage. This tutorial also works for other Ubuntu installations, just skip the part about installing Ubuntu 20.10 on a Hetzner server.

Update: I updated this server to Ubuntu 21.04 and reinstalled sftpgo with these commands:

Upgraded to 21.04

sudo do-release-upgrade

Reinstalled sftpgo

sudo apt install software-properties-common
sudo add-apt-repository ppa:sftpgo/sftpgo
sudo apt reinstall sftpgo
sudo systemctl status sftpgo

Activate the rescue system on the Hetzner Robot web page and install Ubuntu 20.10

You will now have a root password. When you reset the server with Reset – Send CTRL-ALT-DEL to the server you can log in and run installimage

Log in to the server running the rescue system

I use terminal on mac or Ubuntu on Windows

ssh root@

Run installimage


Choose “install ubuntu 20.10 minimal”. Since it is not an LTS release you can easily add the SFTPGO PPA repository later.

The default settings for this 4 x 6 TB HDD server is RAID level 6 where two hard drives are redundant. 2 TB for / and almost all of the rest for /home is the default. I changed to RAID level 5 so only one hard drive is redundant and set 1080G for / and 1080G for /home and the rest in /srv (14TB) for SFTPGo to use.

Install Ubuntu by exiting the editor with F10 and finish the installer

Reboot the server


Log in to the server running Ubuntu 20.10

ssh root@

Check storage with df -h

df -h

Add a sudoer user

It is recommended to use a normal user that is part of the sudo group instead of using root.

sudo adduser newuser
usermod -aG sudo newuser

Login in with the new sudo user

When you need to do something as root use sudo. Or su.

ssh newuser@

Update Ubuntu

sudo apt update
sudo apt upgrade

Disable root ssh login and change ssh port (optional)

For security reasons it is common to change the default ssh port and disable root ssh login. If you leave the default port open you can install a brute force blocker like sshguard.

sudo apt install nano
sudo nano /etc/ssh/sshd_config

Comment # PermitRootLogin to disable root login.

Change the port to 2222

Restart the sshd service

sudo systemctl restart sshd.service 

Log in with the new port number

ssh newuser@ -p 2222

Change the firewall on the Hetzner server admin web site to use the alternative SSH port, SFTPGO SFTP port and web admin UI port

I edited the webserver firewall template to also accept SSH/SFTP on port 2222, 2022, and HTTP on 8080.

Install SFTPGO

The easiest way to install SFTPGO is to add the SFTPGO PPA repository to Ubuntu 20.10. In 20.04 LTS it is not allowed by default to add PPA repositories.

sudo apt install software-properties-common 
sudo add-apt-repository ppa:sftpgo/sftpgo
sudo apt install sftpgo
sudo systemctl status sftpgo

Open the SFTPGO web admin UI to the internet

Change the “httpd” “address”: “”” to “httpd” “address”: “” in the sftpgo.json configuration file so you can access the web admin UI from the internet. You can also enable the built-in brute force defender if you change “defender” to “enabled”.

It is also possible to enable HTTPS SSL/TLS encryption using certbot, as I wrote about in this post.

sudo nano /etc/sftpgo/sftpgo.json

Restart sftpgo

sudo systemctl restart sftpgo

Change the default admin password

Login to the web admin interface with a web browser with the username “admin” and the password “password”.
Use the IP address of the server and port 8080. Like

Change the default admin password in Admins.

Add a SFTPGO SFTP user

The minimum settings for a user are:
-and permissions like all * or download only.
If the user is called user1 the default directory is /srv/sftpgo/data/user1. The user can only upload and download to this directory. User1 is not an actual user on the system and needs a home directory that the sftpgo user has access to like /srv. You can also choose to enable max connections, disk storage quota, max bandwidth, and more.

You can now connect to the SFTP server with Cyberduck or similar SFTP clients. I recommend using Cyberduck because it uses segmented downloads. With SFTPGo 2.1 you can also connect using the Web Client which lets you download from a web browser and download manager.

Connect to the SFTPGO SFTP server using an SFTP client to upload or download

Choose SFTP, port 2022, username, and password.

Try uploading and downloading. I get 22 MB/ sec downloading on a 200 mbit connection.

Connect to the Web Client to download or change credentials

Type in in a web browser to download files in the web client

You can enable HTTPS SSL/TLS encryption using certbot on the web client, as I wrote about in this post.

See which users are connecting and downloading (optional)

When clicking on connections in the SFTPGO web admin UI you can see who are downloading or uploading.

Check CPU and memory usage on the server with htop (optional)

sudo apt install htop

SFTPGO uses a litte more CPU than the Openssh SFTP server. The server seems to handle it well.

Posted on Leave a comment

Setting up SFTP with chrooted users and some other things you can do on a dedicated Linux server

In my post Some tips on downloading and uploading DCPs and large files I wrote about using Filemail, IBM Aspera and Amazon s3 and a dedicated sftp server

Here are some tips when setting up SFTP on a dedicated server running Ubuntu 20.04 or 20.10. A hetzner auction server starts at 30 euros a month. A Raspberry Pi 4/400 costs around 100 euros and can be used as an SFTP server.

Start the OpenSSH server

The OpenSSH server is already running on Ubuntu server, but if you are using Ubuntu Desktop you can install and start the Openssh server

sudo apt update
sudo apt install openssh-server
sudo systemctl status ssh

Recommended SSH client

On mac I use terminal. On Windows I use Ubuntu on WSL. To connect to the server.

ssh root@

Recommended SFTP client

Cyberduck is a fast SFTP client for Windows and Mac because it uses segmented downloads by default.

Setting up basic security

Generating good passwords

sudo apt install pwgen

Generate a 12 digit password

pwgen 12 1


Use nftables firewall to accept only port 22 SSH/SFTP. If Nftables is not installed you can install it and start it with these commands.

sudo apt update
sudo apt install nftables
sudo systemctl enable nftables
sudo systemctl start nftables
sudo systemctl status nftables

Edit nftables.conf with modified Simple ruleset for a server to only accept SSH/SFTP

sudo nano /etc/nftables.conf
#!/usr/sbin/nft -f

flush ruleset

table inet firewall {

    chain inbound {

        # By default, drop all traffic unless it meets a filter
        # criteria specified by the rules that follow below.
        type filter hook input priority 0; policy drop;

        # Allow traffic from established and related packets.
        ct state established,related accept

        # Drop invalid packets.
        ct state invalid drop

        # Allow loopback traffic.
        iifname lo accept

        # Allow all ICMP and IGMP traffic, but enforce a rate limit
        # to help prevent some types of flood attacks.
        ip protocol icmp limit rate 4/second accept
        ip6 nexthdr ipv6-icmp limit rate 4/second accept
        ip protocol igmp limit rate 4/second accept

        # Allow SSH on port 22.
        tcp dport 22 accept

        # Allow HTTP(S).
        # -- From anywhere
        #tcp dport { http, https } accept
        #udp dport { http, https } accept
        # -- From approved IP ranges only
        # tcp dport { http, https } ip saddr $SAFE_TRAFFIC_IPS accept
        # udp dport { http, https } ip saddr $SAFE_TRAFFIC_IPS accept

        # Uncomment to allow incoming traffic on other ports.
        # -- Allow Jekyll dev traffic on port 4000.
        # tcp dport 4000 accept

        # Uncomment to enable logging of denied inbound traffic
        # log prefix "[nftables] Inbound Denied: " flags all counter drop


    chain forward {

        # Drop everything (assumes this device is not a router)
        type filter hook forward priority 0; policy drop;

        # Uncomment to enable logging of denied forwards
        # log prefix "[nftables] Forward Denied: " flags all counter drop


    chain outbound {

        # Allow all outbound traffic
        type filter hook output priority 0; policy accept;



List the NFT ruleset

sudo nft list ruleset

Stop brute force attacks with sshguard and nftables

Install nftables if necessary

To set up sshguard I used the instruction from here

sudo apt install sshguard

Add sshg-fw-nft-sets to BACKEND= in sshguard-conf if needed

sudo nano /etc/sshguard/sshguard.conf

on Raspberry Pi


Start sshguard

sudo systemctl enable sshguard
sudo systemctl restart sshguard
sudo systemctl status sshguard

Soon you will see blocked IP addresses when you list the NFT ruleset

sudo nft list ruleset

Make chroot jail sftp users that can download and upload only from a folder in their home directory

To enable SFTP with chrooted users you need to manually edit sshd_config with the correct settings that disable shell login and then manually add chrooted users.
Link: How to use SFTP with a chroot jail

Change these settings in /etc/ssh/sshd_config

nano /etc/ssh/sshd_config

Put a comment # before this line


#Subsystem      sftp    #/usr/lib/openssh/sftp-server

Add this line

Subsystem sftp internal-sftp

add the group sftpusers

Match Group sftpusers
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
X11Forwarding no

Make a download user called user1 that can download and upload to only /home/user1/data

sudo useradd -g sftpusers -s /sbin/nologin -m -d /home/user1 user1
sudo passwd user1
sudo chown root:root /home/user1
sudo chmod 755 /home/user1/
sudo mkdir /home/user1/data
sudo chown user1:sftpusers /home/user1/data
sudo chmod 755 /home/user1/data
sudo systemctl restart sshd.service

You can also use shell scripts like these made by Matthieu Petiteau on GitHub to do this faster.

Updating the server regularly

It is important to update the server regularly if you are running an unmanaged server.

sudo apt update
sudo apt upgrade

More info: here

Make a user with sudo privileges instead of using root

When Ubuntu is installed you have root access and can log on to the server in an SSH shell with the root account. For better security, make a user with Sudo privileges that is used instead of root.

sudo adduser newuser

usermod -aG sudo newuser

Source: How To Add User To Sudoers & Add User To Sudo Group On Ubuntu

Disable PermitRootLogin yes from /etc/ssh/sshd_config

When you have a sudoer user, you can disable ssh root login. Comment PermitRootLogin yes in sshd_config to disable root access.

sudo apt install nano
sudo nano /etc/ssh/sshd_config
#PermitRootLogin yes

Restart the sshd service
sudo systemctl restart sshd.service 

Backup or copy data to another linux server with rsync over ssh

More info on the commands here. Sync a directory and subdirectories to another server.

rsync -aP /home/user/data/ download1@

Other things you can do on a Linux server

Logging on to the server with SSH and downloading a DCP folder or videofiles from another SFTP/FTP server

Sometimes it can be nice to download something directly from FTP servers and Filemail via ftp to the server. In terminal, you can use SSH to log in to the server and use the command screen to detach from the session so you can resume it if the connection to the server is broken.

ssh user@

If I want to download something to a folder /home/user/download/newfolderwiththings.

cd /home/user/download
mkdir newfolderwiththings
sudo apt update
sudo apt install ncftp
sudo apt install screen
ncftp -u username

When you have started ncftp you can use get with the recursive command -R to download a folder and subdirectories. And use ls to list the content and cd to change directories,

cd folder
get -R /folderwithhings

Detach from the screen by using control + a,d

When connecting to the ssh server again, use screen -r to attach to the session again.

screen -r 

If you have started many screen sessions, you will get a list of sessions so you can choose which to start. To exit a screen session, you can use


Compress and uncompress files on the server

You can make a 7z compressed archive of files on the server so it would be faster to download them. You can also upload an archive and then uncompress it on the server. You can also split the archive into parts so you can download many parts at once. You can use screen to quit the ssh session while the files are being compressed.

Install 7z

sudo apt update
sudo apt install p7zip p7zip-rar p7zip-full 

Compress a folder and its subdirectories

7z a -r directory.7z /directory

Compress a file

7z a archive.7z file.wav

Compress a directory and subdirectories. Normal compression.

Useful for wav files and similar files that will compress to half the size. Split into 3 GB parts. Cyberduck’s default setting is to use segmented downloads, but it can speed up uploads and downloads to split files into parts.

7z a -r -v3000m directory.7z  /directory

Compress file. Using -mx0 for no compression. Split into 3 GB parts . Useful if you want to make the archive faster and for files that don’t compress much like prores video files.

7z a -mx0 -v3000m archive.7z

You can also upload 7z archive files and extract them on the server.
Extract archive recursively and keep the subdirectories

7z x archive.7z

Making an MD5 checksum file of files in a directory

You can check the MD5 checksum of a file on the server with the command

md5sum file

To be able to test the integrity of a folder with files, you can have md5 text checksum files. You can make a checksum.md5 file for files in a directory like this:

md5sum * > checksums.md5

To check the checksum of the files in a directory with the md5 checksum file, you can use

md5sum -c checksums.md5

Mount a remote directory with sshfs and fuse.

Sometimes it can be handy to change the name of a DCP that is on the server. Or do other things with files on the server as if they were on your local computer. With sshfs and fuse, you can mount a folder on the server as a local folder and open it in Easydcp Creator and change the name or other metadata like the content kind or the offset on reels. Easydcp Creator saves the new metadata to the folder on the server.
To mount the folder from the server locally on my mac, I use the commands from here

Install Homebrew

Install osxfuse and sshfs in the terminal with these commands

brew cask install osxfuse
brew install sshfs

Make a local directory that the folder will be mounted in. In Terminal I made a directory called server on the desktop.

cd Desktop
mkdir server

To mount the folder on the server, you use the sshfs command (link man sshfs)

sshfs [user@]host:[dir] mountpoint [options]

This is how you mount the home folder of the user yourname

sshfs yourname@ /Users/yourname/Desktop/server

To open the DCP in the Easydcp Creator, I drag the folder to the Easydcp window and wait a little bit. You can also open a Resolve or Premiere project this way.

To unmount, you can use the umount command

sudo umount /Users/yourname/Desktop/server

Converting a video file or sound file on the server with ffmpeg

Converting a high-quality video file to a low-res version on the server so it can be downloaded easier. Example: You need a file to check subtitles. Or a small file to upload as a screener.
If you need a small size h264 video file of a file on the server, you can use FFmpeg to convert it.

sudo apt update
sudo apt install ffmpeg 
ffmpeg -i smallfile.mp4
ffmpeg -i bigfile.wav smallfile.aac