Create FTP user on AWS Lightsail

AWS Lightsail is a really easy to use cloud platform for deploying cost-effective websites. While it runs on EC2 servers there is no way to access Lightsail servers through FTP or SFTP by default...

4 months ago

Latest Post Kubernetes Cheat Sheet by Tyler Moon

AWS Lightsail is easy to use cloud platform for deploying cost-effective websites. While it runs on EC2 servers there is no way to access Lightsail servers through FTP or SFTP by default. This limitation can cause issues when trying to backup a Wordpress blog, or move files around. Luckily it is quite simple to set up a new FTP user through SSH!

Prerequisites

Networking

The first thing we need to do is open the required ports. Head over to the AWS Lightsail console and open up your instance. Click on the "Networking" tab and scroll down to the Firewall section. Select the "Add another" and add in the following firewall rules:

Custom   TCP   21-22
Custom   TCP   1024-1048

It should look something like the following:

Install FTP daemon and create an FTP user

SSH to your Lightsail instance, there is an easy web-based terminal on the Lightsail console, and run the following commands to install the vsftpd process:

sudo apt install vsftpd // Install
sudo chkconfig --level 345 vsftpd on // Start on reboot

After that installs, run sudo vim /etc/vsftpd.conf to edit the vsftpd config file. Scroll to the bottom of the file and enter the following:

i // Vim Command to insert

pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=<LightsailPublicIpAddress>

:wq // Quit and save
Note: If you want to upload files then change #write_enable to write_enable

Now run the following to create a new user and assign them to the existing bitnami group so that they will have access to the home directory of the default SSH user

sudo /etc/init.d/vsftpd restart // Restart FTP server
sudo adduser ftpuser // Create new Linux user
sudo usermod -d /home/bitnami ftpuser // Allow access to the bitnami home dir
sudo usermod -a -G bitnami ftpuser // Add ftpuser to the bitnami group
sudo /etc/init.d/vsftpd restart // Restart FTP server

Use new FTP user

After creating that new user its time to try it out. Open up a new terminal and run ftp ftpuser@<LightsailPublicIpAddress> to run the ftp program and connect to the server. Now you can download and upload to your Lightsail server.

Summary

In this simple article, we saw how to set up an FTP user for an AWS Lightsail instance.

Tyler Moon

Published 4 months ago

Comments?

Leave us your opinion.