Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up SFTPGo on a Linux Server – Your Own SFTP Server with a Web Interface

Set up SFTPGo on your Linux server as a One-Click App with an admin login, or install it using Docker Compose. Create your own SFTP users and folders.

3 December 202613 min read3 Views0 helpful

Introduction

SFTPGo is an SFTP file server that you manage through a web interface. There, you can create your own users, who are separate from your server's Linux accounts. Each user sees only their own folder, can be assigned a storage limit, and can upload and download files using an SFTP program such as FileZilla or WinSCP, or directly in a browser. If you like, SFTPGo also supports FTP/S and WebDAV.

In this guide, we'll show you two ways to get started: the easy way, using the One-Click App, which makes SFTPGo available with a web interface over HTTPS within a few minutes, and manual installation with Docker Compose. Then you'll create your first user, connect via SFTP, and upload your first file.

When SFTPGo Makes Sense on a VPS

Your VPS can already use SFTP through SSH without any additional software; see Connecting via SFTP. SFTPGo is useful when:

  • Multiple people need to exchange files, such as customers, colleagues, or gaming friends, without giving each person a Linux account with shell access to your server.
  • Each person should see only their own folder. SFTPGo confines each user to their directory, and you assign permissions for each user and folder.
  • You want to limit storage space. You can set a limit on the size and number of files for each user.
  • Files should be transferable without an SFTP program. In the WebClient, each user can upload and download files in a browser and create share links for external users.
  • You want to manage accounts centrally, with groups, public keys, two-factor authentication, and a log of who transferred what and when.

SFTPGo is less suitable if you only want to transfer files to the server yourself. In that case, SFTP access through SSH is enough. If you're looking for a cloud service with synchronization, a calendar, and smartphone apps, Nextcloud is a better choice.

SFTPGo or SFTP over SSH?

SFTP over SSHSFTPGo
UsersThe server's Linux accountsSeparate SFTPGo accounts, without shell access
Folder per userOnly with a custom SSH configurationBuilt in; each user sees only their own folder
ManagementVia the consoleWeb interface and REST API
Browser uploads and share linksNoYes, via the WebClient
Storage limitsOnly via system quotasPer user, in the interface
Port22Custom port; 2222 by default for the One-Click App
GuideConnect via SFTPThis page

You can use both together: continue managing the server over SSH while giving other people an account in SFTPGo only.

The Easy Way: SFTPGo as a One-Click App

The quickest way to get SFTPGo is through your VPS's One-Click Apps. The app includes a PostgreSQL database for users and settings. The web interface is available over HTTPS directly through your domain, and the app opens the SFTP port itself.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Setting Up One-Click Apps for instructions.
  • SFTPGo and PostgreSQL need 512 MB of free RAM; 1 GB is recommended. The available disk space for your users' files is what matters most.
  • An available port for SFTP. The default is 2222; you can choose a different one during installation.

Install

  1. Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Find SFTPGo in the app catalog and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave the option enabled and enter a custom name if needed, such as my-files. You can use this address to access the web interface over HTTPS.
  4. There are three optional fields under App configuration. PORT_SFTPGO sets the SFTP port; the default is 2222. If this port is already in use on your server, enter a different available port. Leave POSTGRES_DATABASE (sftpgo-db) at its default value. LOG_LEVEL is set to info; set it to debug for more detailed logs when troubleshooting. The panel automatically generates credentials for the database and your admin account (SERVICE_USER_ADMIN, SERVICE_PASSWORD_ADMIN).
  5. Click Queue installation.

After a few minutes, the app card will show Online. On its first start, SFTPGo creates the database tables and your admin account. Under Connection, the card shows the SFTP address: your VPS's IP address and the SFTP port.

First Login

  1. Open the app card's App environment tab using the gear icon. Under Automatically generated values, you'll find your username as SERVICE_USER_ADMIN and your password as SERVICE_PASSWORD_ADMIN. Click the eye icon to show a value, or the icon beside it to copy it.
  2. On the app card, click Open admin area in the Login and SFTP notice. Alternatively, add /web/admin to the app's address, for example, https://my-files-12345.zap.cloud/web/admin. The Access link without anything added takes you to the WebClient for users.
  3. Log in with the two values. You'll then arrive at the user list in the WebAdmin interface.

The One-Click App does not have a setup page where any visitor can create the first admin account. The admin account already exists before the app becomes accessible.

Info: The generated values are valid only for the first start

SFTPGo creates the admin account only if there isn't already an admin account. If you later change your password in SFTPGo, App environment will continue to show the old value. Be sure to save your new password in your password manager.

After logging in, we recommend enabling two-factor authentication for your admin account: click the person icon in the top-right corner, open Two-factor authentication, scan the QR code with an authenticator app, and confirm with the code. You can change your password in the same menu under Change password.

SFTP Port and Firewall

The One-Click App publishes only the SFTP port on all of your server's addresses: 2222, or the value you entered for PORT_SFTPGO. The web interface runs on port 8080 inside the container and is accessible externally only through your domain over HTTPS.

The SFTP port must be open, or SFTP programs won't be able to reach the server. If you use your VPS's Network firewall with a rule that blocks all incoming traffic, add a rule allowing incoming TCP connections on this port. To make SFTP available only to specific people, enter their IP addresses as the rule's source.

Tip: Secure access for open ports

The SFTP port is accessible from the entire internet, and automated scanners try passwords on it. So use long, random passwords or use public SSH keys for your users instead of passwords.

FTP and WebDAV

In addition to SFTP, SFTPGo supports FTP/S and WebDAV. Both are disabled by default in the One-Click App, and the app doesn't publish ports for them. SFTP is usually the better choice because it encrypts logins and file transfers. If you need FTP/S or WebDAV, use the manual installation below, where you set the ports and certificates yourself.

Updates and Backups

You can update SFTPGo in the app settings (gear icon) under App update. Click Check for updates, then install a new version using Apply update. If it says the app is up to date, there isn't a newer version in the app catalog yet. The app uses the v2.7-alpine image series and receives bug fixes for version 2.7 through it.

Users, groups, and settings are stored in the PostgreSQL database, while your users' files are in the app's data volume at /srv/sftpgo/data. Both are retained during updates. Back up the entire VPS through Backups in the dashboard. You can also export users and settings from the web interface under Server Manager > Maintenance, using Backup to create a JSON file. Keep the file somewhere off the server. It doesn't include users' files. Use Restore on the same page to restore a file.

Manual Installation

The rest of this guide describes the manual installation of SFTPGo with Docker Compose. For example, you might use it if you don't use One-Click Apps on your server, need FTP/S or WebDAV, or want to run SFTPGo behind your own reverse proxy. We'll use the same image as the One-Click App, but use the built-in SQLite database instead of PostgreSQL. That's enough for a single server.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access; see First Access via SSH.
  • Docker and Docker Compose (Compose v2); see Install Docker. Check the installation with docker --version and docker compose version.
  • A domain or subdomain whose A record points to your VPS's IP address (e.g., files.example.com), for the web interface over HTTPS.
HardwareMinimumRecommended
CPU1 vCPU core2 vCPU cores
RAM256 MB1 GB
Storage2 GB plus user dataDepends on the users' data

Prepare the Firewall

In the default configuration, SFTPGo uses port 2022 for SFTP and port 8080 for the web interface. In this guide, you'll access the web interface only through a reverse proxy. Use ufw to allow SSH, the ports for the reverse proxy, and the SFTP port:

Code
ufw allow OpenSSH
ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 2022/tcp
ufw enable
Warning: Docker bypasses ufw

Ports published by Docker with ports: are accessible externally even if ufw blocks them. Docker adds its own rules before the rules set by ufw. Therefore, bind the web interface to 127.0.0.1 only, as described below. For more about the firewall, see Managing the Firewall on Linux.

Install with Docker Compose

Create the directories. The image runs with user ID 1000, so these directories must belong to that user:

Code
mkdir -p /opt/sftpgo/data /opt/sftpgo/home
chown -R 1000:1000 /opt/sftpgo/data /opt/sftpgo/home
cd /opt/sftpgo

Generate a password for your admin account in the .env file:

Code
echo "SFTPGO_ADMIN_PASSWORD=$(openssl rand -hex 16)" > .env
chmod 600 .env
cat .env

Make a note of the password. Then create the docker-compose.yml file (nano docker-compose.yml) and add this content:

Code
services:
  sftpgo:
    image: ghcr.io/drakkan/sftpgo:v2.7-alpine
    container_name: sftpgo
    restart: unless-stopped
    environment:
      SFTPGO_DATA_PROVIDER__CREATE_DEFAULT_ADMIN: "true"
      SFTPGO_DEFAULT_ADMIN_USERNAME: admin
      SFTPGO_DEFAULT_ADMIN_PASSWORD: ${SFTPGO_ADMIN_PASSWORD}
    ports:
      - "2022:2022"
      - "127.0.0.1:8080:8080"
    volumes:
      - ./data:/srv/sftpgo
      - ./home:/var/lib/sftpgo

Here's what the important lines mean:

  • image: The official image in the 2.7 series. With v2.7-alpine, docker compose pull gets you bug fixes, but doesn't upgrade to a new major version.
  • SFTPGO_DATA_PROVIDER__CREATE_DEFAULT_ADMIN and SFTPGO_DEFAULT_ADMIN_*: Create the admin account with your password on the first start. Without these lines, SFTPGo opens a setup page at /web/admin on the first visit, where any visitor can create the first admin account.
  • 2022:2022: The SFTP port, intentionally accessible externally.
  • 127.0.0.1:8080:8080: Makes the web interface accessible only from the server itself, and externally only through the reverse proxy.
  • ./data:/srv/sftpgo: This is where user folders (data/data/<benutzer>) and backups created through the interface (data/backups) are stored.
  • ./home:/var/lib/sftpgo: This is where the SQLite database containing users and settings and the server's SSH keys are stored. If the keys are lost, SFTP programs will report that the server key has changed the next time they connect.

Pull the image and start the container:

Code
docker compose pull
docker compose up -d
docker compose logs --tail 20

First Visit

Before making the web interface publicly accessible, you can check it through an SSH tunnel. Run this on your own PC:

Code
ssh -L 8080:127.0.0.1:8080 root@SERVER_IP

Then visit http://localhost:8080/web/admin in your browser and log in with admin and the password from .env. Under Server Manager > Status, you can see which services are running: SFTP on port 2022; FTP and WebDAV are disabled by default.

Access over HTTPS via a Reverse Proxy

For the web interface, place a reverse proxy with a valid certificate in front of SFTPGo. For the basics, see Setting Up a Reverse Proxy with nginx and Create an SSL Certificate (Let's Encrypt). Here's a server block for nginx:

Code
server {
    listen 80;
    server_name files.example.com;
    client_max_body_size 0;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_request_buffering off;
    }
}

Then obtain the certificate with certbot --nginx -d files.example.com. Certbot adds HTTPS and the HTTP redirect to the block. client_max_body_size 0 and proxy_request_buffering off ensure that large uploads in the WebClient also work through the proxy. SFTP doesn't go through the proxy; it connects directly over port 2022.

Find more tips on securing your server in Linux Security Tips.

Back Up Your Data

Everything important is in /opt/sftpgo: users' files are in data, and the database and server keys are in home. To create a backup while SFTPGo is stopped, stop it briefly:

Code
cd /opt/sftpgo
docker compose stop
tar czf /root/sftpgo-$(date +%F).tar.gz -C /opt sftpgo
docker compose start

Don't keep the archive only on the VPS itself. You can export users and settings alone without any downtime from the web interface under Server Manager > Maintenance, using Backup.

Update SFTPGo

Create a backup first, as described above. To update within the 2.7 series, run:

Code
cd /opt/sftpgo
docker compose pull
docker compose up -d
docker image prune

To install a new major version, enter its new tag in docker-compose.yml, for example v2.8-alpine once it's available. Read the notes on the SFTPGo releases page first. SFTPGo applies any required database changes on startup. docker image prune then removes the old images.

Create Users and Transfer Files

After setting up SFTPGo, create users and connect via SFTP. For the One-Click App, the port is 2222 or your value for PORT_SFTPGO; for manual installation, it's 2022.

Create Your First User

  1. Log in at /web/admin and open Users on the left.
  2. Click Add.
  3. Enter a Username and Password. Instead of a password, you can add the user's public SSH key under Public keys.
  4. Leave the Root directory field empty under File system. SFTPGo will then automatically create a folder for the user on their first login.
  5. If needed, set a limit under Disk quota and bandwidth limits, such as 10GB for Quota size. Under ACLs, restrict permissions, for example, to read-only and download access.
  6. Click Save.

The user can log in immediately and will see only their own folder. To give multiple users the same settings, create a group under Groups and assign the users to it.

Connect with FileZilla, WinSCP, or the Console

In FileZilla, enter the following at the top:

FieldValue
Serversftp://SERVER_IP
UsernameThe username from SFTPGo
PasswordThe user's password
Port2222 or your value for PORT_SFTPGO (One-Click App), or 2022 (manual installation)

In WinSCP, select SFTP as the transfer protocol and enter the same values. To connect from the console, run:

Code
sftp -P 2222 benutzer@SERVER_IP

The first time you connect, the program will ask whether you trust the server's key. Compare the fingerprint with the one in the web interface under Server Manager > Status, where you'll find the SFTP server's keys. Then confirm the prompt. You can now upload and download files as usual. You can use your domain instead of the IP address; it points to the same server.

Info: Don't confuse this with SSH access

If you connect on port 22 with your root credentials, you'll access the entire server's file system, not SFTPGo. SFTPGo users can log in only through SFTPGo's SFTP port.

Share Files in a Browser

Each user can log in to the WebClient in a browser. For the One-Click App, the Access link takes them directly there; otherwise, add /web/client to your address. In the WebClient, the user can upload files under Files using Upload Files, create folders with New Folder, and download files. They can change their password and add their public keys using the person icon in the top-right corner, or enable two-factor authentication under 2FA.

Under Shares, they can create share links for files or folders, optionally with a password, an expiration date, and an access limit. You can control whether a user is allowed to create shares in their settings.

Limitations

  • Only one SFTP port with the One-Click App: FTP/S and WebDAV aren't enabled. For those, you need the manual installation with custom ports and certificates.
  • No synchronization: SFTPGo is a file server, not a sync service. For folders that automatically sync across multiple devices, use a cloud service such as Nextcloud.
  • No access to other server folders: One-Click App users can store files only in the app's data volume. SFTPGo can't access folders belonging to other apps or your system.
  • Your VPS storage is the limit: All files are stored on your VPS's disk. Keep an eye on the available storage and set limits for users.

Conclusion

With SFTPGo, you now have your own SFTP server with a web interface where you manage users, folders, permissions and storage limits in one place, without giving other people an account on your server. If you also need sync, calendars or smartphone apps, the guide Set Up Nextcloud on a Linux Server shows you how to set up your own cloud.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App uses port 2222 for SFTP by default. If you entered a different value for PORT_SFTPGO during installation, use that port instead. The manual installation in this guide uses port 2022. Port 22 is still for your server's SSH access. Always enter the SFTPGo port in your SFTP program, or you won't connect to SFTPGo.
First, check the port: port 22 connects to the server's SSH service, which doesn't know about SFTPGo users. Log in with the SFTPGo username and password, using the SFTPGo port. SFTPGo will reject the login if the user is disabled under Users or the password is incorrect. If your VPS's network firewall blocks incoming connections, allow the SFTP port there.
Yes. In addition to SFTP, SFTPGo supports FTP/S and WebDAV. Both are disabled by default in the One-Click App, and no ports are open for them. If you need them, use the manual installation and enable the service through SFTPGo's environment variables, with a custom port and TLS certificate. SFTP is enough for most cases because it encrypts logins and file transfers.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.