AWS, Cloud Computing

4 Mins Read

A Guide to Setup an SFTP Server on Linux


SFTP, or Secure File Transfer Protocol, is a secure file transfer protocol that uses secure shell encryption to provide high security for sending and receiving file transfers.

Some of the benefits of SFTP are:

  • Secure File Transfer – SFTP is primarily used for securely transferring files between systems over an insecure network, such as the internet. It ensures that data remains confidential and protected from unauthorized access during transit.
  • Remote Server Administration – SFTP is commonly used by system administrators to remotely manage servers. They can securely upload, download, and modify files on the server, perform backups, update configurations, and execute administrative tasks.
  • Website Maintenance – SFTP is often employed by web developers and designers to update and maintain websites hosted on remote servers. It allows them to upload new files, modify existing ones, and manage the website’s directory structure securely.
  • Automated File Transfers – SFTP can be integrated into automated workflows and scripts, allowing for the scheduled or event-driven transfer of files between systems. This is useful for tasks like data backups, synchronizing files between servers, and distributing files to multiple locations.
  • Secure Data Exchange – Organizations that need to exchange sensitive data with external partners, clients, or suppliers can utilize SFTP to ensure the secure transfer of files. SFTP’s encryption and authentication mechanisms provide a higher level of security compared to traditional FTP.
  • Cloud Storage Integration – Many cloud storage providers support SFTP as a method for securely accessing and transferring files to and from cloud storage. This enables users to interact with their cloud-based files using SFTP clients, providing an additional layer of security.

Step-by-Step Guide

Step 1: Set up an SFTP directory on a Linux server

In the below scenario, we are using Ubuntu 20.4 server hosted on Azure.

We will create a directory named ‘data’ under / directory with full owner permissions, group no permissions, and others only execute permission.


Step 2: Create an SFTP group and user

Now we will create a group named ‘sftp_users’ and add the user ‘YOURUSERNAME’ to group ‘sftp_users’ only for sftp.

Run the below commands for the same


Step 3: Set up a new user SFTP directory

Now, we will create a directory ‘YOURUSERNAME/upload’ under ‘/data’ directory with user  ‘root’ as the owner and ‘sftp_users’ group as the group for directory /data/YOURUSERNAME.

user ‘YOURUSERNAME’ as owner and ‘sftp_users’ group as the group for directory /data/YOURUSERNAME/upload

Run the below commands for the same.


Step 4: Configure sshd using the below command


Step 5: Save the File and run the below command to restart the sshd service



Step 6: Logging in

From a different machine on your network that has SSH installed, open a new terminal window and run the below command:


Step 7: Upload a file

Now, let’s upload a ‘test’ file to sftp server using PUT command.


Verify our upload by browsing to the sftp directory, which we created in Step 3


Pioneers in Cloud Consulting & Migration Services

  • Reduced infrastructural costs
  • Accelerated application deployment
Get Started


This blog shows how to set up an SFTP server and transfer files securely from a local machine to a remote server using the SFTP protocol.

Other alternative file transfer clients using SSH besides CLI are SCP, FileZilla, etc.

Making IT Networks Enterprise-ready – Cloud Management Services

  • Accelerated cloud migration
  • End-to-end view of the cloud environment
Get Started

About CloudThat

CloudThat is an official AWS (Amazon Web Services) Advanced Consulting Partner and Training partner and Microsoft Gold Partner, helping people develop knowledge of the cloud and help their businesses aim for higher goals using best in industry cloud computing practices and expertise. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

Drop a query if you have any questions regarding SFTP, Linux Server and I will get back to you quickly.

To get started, go through our Consultancy page and Managed Services Package that is CloudThat’s offerings.


1. What does SFTP stand for?

ANS: – SFTP stands for Secure File Transfer Protocol which uses SSH port 22 to transfer the file to a remote server.

2. What if SSH is not installed or not enabled?

ANS: – Install the ‘openssh-server’ package on Ubuntu by running the below command.

To Enable SSH server on Ubuntu By default, SSH access will be blocked by the firewall. Open the port using the below command.

3. What are other SFTP commands available?

ANS: – Some of the basic commands are mentioned below-

WRITTEN BY Sumeet Agarwal



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!