Guide To Setup Secure File Transfer Protocol (SFTP) Client Server Ubuntu AWS

How to create an SFTP client for AWS Ubuntu server ?

November 18, 2020 / Nirav Shah

Guide To Setup Secure File Transfer Protocol (SFTP) Client Server Ubuntu AWS

What is the use of SFTP?

SFTP (SSH File Transfer Protocol, also known as Secure FTP) is a popular method for securely transfer of files to/from remote systems. SFTP was designed as an extension of the Secure Shell protocol (SSH) version 2.0 to enhance secure file transfer capabilities.

Steps to set-up SFTP in the AWS Ubuntu server


  • AWS account
  • EC2 Ubuntu Server

Step 1

Step 2

Connect to your server

Step 3

Update and upgrade your server to get the latest packages

$ sudo apt update && sudo apt upgrade -y

Step 4

Install apache2 as we are going to give access to SFTP of HTML folder only

$ sudo apt install apache2 -y

Step 5

Now add a new user ( In our case, we have given name sftptestuser )

$ sudo adduser sftptestuser

Create a password to access the user via FTP/sFTP client

Optional Fill all the details and the press y and press ENTER

Step 6

Add the file path in front of the username by editing in /etc/passwd file

$ sudo vim /etc/passwd

As you can see in the last line


Launch an AWS Ubuntu server instance

Step 7

Edit the /etc/ssh/sshd_config to allow the access the user via password

$ sudo vim /etc/ssh/sshd_config

Add the below line to the end of the config file as you can see in the image

$ Match User
$ PasswordAuthentication yes


Step 8

Navigate to the /var/www

$ cd /var/www

Step 9

Change the ownership of the HTML to be accessible to the sFTP user

$ sudo chown -R ftpusername:www-data html

Step 10

Go inside the HTML folder and paste the command as under

$ cd /var/www/html

$ sudo find . -type d -exec chmod -R 775 {} \;

$ sudo find . -type f -exec chmod -R 664 {} \;

Step 11

Go to /var/www and paste the command this will change the ownership of every file that is in the folder HTML

$ cd /var/www

$ sudo chmod -R ugo+s html

Step 12

Now restart the sshd service to implement the changes we have done

$ sudo service sshd restart

Step 13

As you can see in all the above steps we have configured the sFTP user now we will try to connect to the user via FTP/SFTP

  • Protocol:- Public_IP
  • User :- sftpusername
  • Password:- yourselectedpassword

connect to the user via FTP/SFTP

As you can see /var/www/html is listed in the image


Also Read : Install Hibernation for Ubuntu 16.04 LTS on EC


Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let’s Talk About Your Needed AWS Infrastructure Management Services

    Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project