Ends in

48-Hour Sale! All Video Courses at $9.99

SFTP On Your Ubuntu EC2 Instance – Quick and Simple Setup

Home » AWS » SFTP On Your Ubuntu EC2 Instance – Quick and Simple Setup

SFTP On Your Ubuntu EC2 Instance – Quick and Simple Setup

SFTP, which stands for Secure File Transfer Protocol, is a method of transferring files between computers. It operates over SSH (Secure Shell) and uses public-key cryptography for authentication. This means that your login credentials and file transfers are encrypted, making them much more secure than the traditional FTP (File Transfer Protocol).

Why SFTP over SCP?

SFTP and Secure Copy Protocol (SCP) are both network protocols that you can use for transferring files. They also both run on the same default port (22) for  SSH. However, when it comes to transferring large files securely, SFTP stands out as the better option. It not only protects files in transit but also includes features such as the ability to manage directories, resume transfers, and keep a log of transfers. For example, imagine moving large files to your remote server, and your internet connection suddenly drops. With SCP, the transfer will fail, and you will need to start the transfer from the beginning. 

SFTP on Your Ubuntu EC2 Instance - Quick and Simple Setup

However, with SFTP, you can simply resume the transfer from where it left off, saving time and ensuring the successful transfer of your important files.


  1. WinSCP – in this post, we’re using an SFTP client for Windows. You may use a different client suited for your operating system.
  2. Vsftpd – SFTP server
  3. EC2 instance with Ubuntu AMI –  you can create one by following this tutorial.
  4. Open up port 22 (SSH) in your instance’s security group.
Tutorials dojo strip


1. SSH into your EC2 instance and type the following commands:

sudo apt update -y
sudo apt install vsftpd

2. Update the vsftpd.conf file

sudo vi /etc/vsftpd.conf

3. Disable anonymous FTP by changing this line:

from anonymous_enable=YES to anonymous_enable=NO

4. Add the following settings at the bottom of the vsftpd.conf file:


pasv_min_port=1024 3


pasv_address=<Public IP of your instance>

5. To save changes, press the escape key, and then type :wq! and hit enter.

6. Restart vsftpd by typing sudo systemctl restart vsftpd

Access the SFTP server using WinSCP

Select SFTP as the file protocol and enter your instance’s public IP address. Login using the default ubuntu username, and leave the password blank.

SFTP on Your Ubuntu EC2 Instance - Quick and Simple Setup

Click Advanced → Authentication, then select your instance’s private key file. The key should be in PPK format, not PEM. If you got the PEM version, convert it first to PPK. Click OK, then Login.

SFTP on Your Ubuntu EC2 Instance - Quick and Simple Setup

And that’s it! By now, you should be able to transfer files between your local machine and your Ubuntu EC2 instance using an SFTP client. In my case with WinSCP, file transfer is done thru a simple drag-and-drop action.

SFTP on Your Ubuntu EC2 Instance - Quick and Simple Setup

Aside from file transfer, you can also perform other tasks such as managing and organizing files, creating and modifying directories, and even executing command-line operations directly on the remote server through your SFTP client.

Tutorials Dojo portal

Enroll Now – Our AWS Certification Exam Reviewers

AWS Practice Exams Tutorials Dojo

FREE AWS Exam Readiness Digital Courses

Enroll Now – Our Azure Certification Exam Reviewers

azure reviewers tutorials dojo

Enroll Now – Our Google Cloud Certification Exam Reviewers

Tutorials Dojo Exam Study Guide eBooks

tutorials dojo study guide eBook

Subscribe to our YouTube Channel

Tutorials Dojo YouTube Channel

FREE Intro to Cloud Computing for Beginners

FREE AWS, Azure, GCP Practice Test Samplers

Recent Posts

Written by: Carlo Acebedo

Carlo is a cloud engineer and a content creator at Tutorials Dojo. He's also a member of the AWS Community builder and holds 5 AWS Certifications. Carlo specializes in building and automating solutions in the Amazon Web Services Cloud.

AWS, Azure, and GCP Certifications are consistently among the top-paying IT certifications in the world, considering that most companies have now shifted to the cloud. Earn over $150,000 per year with an AWS, Azure, or GCP certification!

Follow us on LinkedIn, YouTube, Facebook, or join our Slack study group. More importantly, answer as many practice exams as you can to help increase your chances of passing your certification exams on your first try!

View Our AWS, Azure, and GCP Exam Reviewers Check out our FREE courses

Our Community

passing rate
Around 95-98% of our students pass the AWS Certification exams after training with our courses.
Over 200k enrollees choose Tutorials Dojo in preparing for their AWS Certification exams.
Our courses are highly rated by our enrollees from all over the world.

What our students say about us?