Set up a local SFTP server in minutes with SFTPGo

This blog post will be focusing on a local SFTP server for development purposes.

Nathan
Nathan's Blog
3 min readSep 7, 2022

--

SFTPGo icon

I had to work with SFTP and needed to set up an SFTP server on my Mac for development. It was very difficult to find software to set up an SFTP server on a Mac. Then I found SFTPGo, a very simple solution to SFTP servers.

SFTPGo, as the name implies, is an SFTP server written in Go language. It can be run on Linux, macOS and Windows. This blog post will proceed with macOS but everything should be the same on all platforms, except for the installation part.

Installation

Run the below command in a terminal to install SFTPGo using brew on macOS.

Run the below command to start the server. This will create an SQLite database and host keys in the current working directory, and run a web interface on port 8080 and an SFTP server on port 2022. We can configure these settings through a configuration file, but for now let’s just start the server the simplest way.

Open http://localhost:8080/web/admin to create an administrator account.

Input fields for setting up a username and a password

Creating a user

Open http://localhost:8080/web/admin to enter the admin console. In Users page, click Add (+) to create a new user.

An web page showing buttons to manage users

Fill in details: a username, a password, a public key (optional if you want to use public key authentication), and a home directory for the user. Click Submit and you are ready to test.

A web page to enter user information: username, password, public keys and home directory

Testing the connection

Run the below command to open an SFTP connection. Of course, replace user with the username you have set in the previous step. This command will open a connection to 127.0.0.1 at port 2022 with user user. It should prompt you to enter a password and establish a successful connection.

Voilà! You have just—hopefully—successfully set up a local SFTP server!

Further configuration

If you want to configure how SFTPGo works, the simplest way is to create a configuration file named as sftpgo with an extension of either JSON or YAML (see the doc for more extensions).

You can configure which public-private key pairs the SFTP server should use as host keys, which port the server should run on, etc.

--

--

Nathan
Nathan's Blog

Software engineer in finance industry. Writes about technology, productivity and life.