If you need to securely transfer files between computers, SFTP is an excellent choice. SFTP is safer and often preferred over SCP (secure copy) because SCP is deprecated and has multiple security risks and issues with no simple solutions. This article will walk you through the steps of installing an SFTP server on an Ubuntu machine.

SFTP

SFTP stands for SSH File Transfer Protocol. It is an SSH-based protocol used to securely transfer files between computers. SFTP operates on a single port, 22, which also serves as the default port for SSH.

SFTP is not the same as File Transfer Protocol over SSH or FTPS (File Transfer Protocol over SSL), but rather a different protocol that uses SSH for encryption, authentication and to perform the same functions as FTP but with greater compatibility and flexibility.

To know if the SFTP server is running on your Ubuntu machine, use the following command:

sudo service ssh status

Prerequistes

Before you start setting up the SFTP server on your Ubuntu instance, make sure you have the following prerequisites:

Setup SFTP Server on Ubuntu

With all the prerequisites met, lets now look at how we can actually to set up an SFTP server on an Ubuntu machine using the steps provided below.

Step 1: Install OpenSSH Server

The first step is to install the OpenSSH server on your Ubuntu machine. OpenSSH (also known as OpenBSD Secure Shell) is a free and open-source implementation of the SSH protocol. OpenSSH is required as it provides us with SFTP protocol and SSH Daemon (sshd) the programme for the SSH client.

If you do not have it installed, you can install it by running the following command:

sudo apt-get update -y

sudo apt-get install openssh-server -y

Step 2: Create Group and User for SFTP