Question: How do I set up an FTP server and an FTP user on my Lightsail instance?

I want to set up an FTP server and FTP user on my Lightsail instance running Amazon Linux 2, CentOS, Ubuntu or Debian. How can I do this?ResolutionNote: FTP transmits all data and passwords as plain text. SFTP is a more secure way to connect to your instance and transmit data. For information on using SFTP, see Connecting to your Linux or Unix instance in Amazon Lightsail using SFTP. For information on creating an SFTP user, see How do I create an SFTP user on my Lightsail instance?1.    Run the following command to install the VSFTPD package:Amazon Linux 2 and CentOSsudo yum install vsftpd -yUbuntu and Debiansudo apt install vsftpd -y2.    Edit the vsftpd.config file to change the variables needed for your environment.The vsftpd.config file location varies depending on your operating system:Amazon Linux 2 and CentOS: /etc/vsftpd/vsftpd.confDebian and Ubuntu: /etc/vsftpd.confChange the variables in the following example as needed for your environment:anonymous_enable=NOlocal_enable=YESwrite_enable=YESdirmessage_enable=YESxferlog_enable=YESconnect_from_port_20=NOxferlog_std_format=YESchroot_local_user=YESallow_writeable_chroot=YESchroot_list_file=/etc/vsftpd/chroot_listlisten=YESpam_service_name=vsftpduserlist_enable=YESuserlist_file=/etc/vsftpd/user_listuserlist_deny=NOlisten_port=10021pasv_enable=YESpasv_min_port=21000pasv_max_port=21999pasv_addr_resolve=NONote: Port 21 is the default port for FTP. You can use port 21. However, in the preceding example, for security reasons custom port 10021 is the port for FTP. To customize the port, change the listen_port to the port that you want use and set connect_from_port_20 to NO. Make sure that you activate the ports that you're planning to use for FTP on your instance firewall. For the preceding example, ports 10021 and 21000-21999 are activated on the custom and Lightsail firewall.3.    Run the following command to add the FTP user:sudo adduser --home /home/ftp_user ftp_userNote: In the preceding example, replace ftp_user with a user name of your choice.4.    Run the following command to create a password for the user:sudo passwd ftp_user5.    Run the following command to change the ownership of the /home/ftp_user file. This command makes ftp_user the file owner.sudo chown ftp_user:ftp_user -R /home/ftp_user/6.    Run the following command to add the new user to the vsftpd user_list. Use the -a flag to append to the file.Amazon Linux 2 and CentOSsudo echo "ftp_user" | sudo tee -a /etc/vsftpd/user_listDebian and UbuntuRun the following command to create the userlist file and add the new user to the file:sudo echo "ftp_user" | sudo tee -a /etc/vsftpd.userlist7.    Restart the vsftpd service:sudo systemctl restart vsftpd8.    Connect to the FTP server. The following example uses Filezilla plain FTP.Status:    Connecting to 54.xxx.xxx.x2:10021...Status:    Connection established, waiting for welcome message...Status:    Plain FTP is insecure. Please switch to FTP over TLS.Status:    Logged inStatus:    Retrieving directory listing...Status:    Server sent passive reply with unroutable address. Using server address instead.Status:    Calculating timezone offset of server...Status:    Timezone offset of server is 0 seconds.Status:    Directory listing of "/" successfulStatus:    Connecting to 54.xxx.1xx.52:10021...Status:    Connection established, waiting for welcome message...Status:    Plain FTP is insecure. Please switch to FTP over TLS.Status:    Logged inStatus:    Starting upload of C:\Users\Administrator\Documents\FTPtest.txtStatus:    Server sent passive reply with unroutable address. Using server address instead.Status:    File transfer successful, transferred 10 bytes in 1 secondStatus:    Retrieving directory listing of "/"...Status:    Server sent passive reply with unroutable address. Using server address instead.Status:    Directory listing of "/" successfulTroubleshoot FTP server setupIncorrect options in vsftpd.conf file can cause the vsftpd service go down. If you can't start it, then run the following command to find which options aren't configured correctly:Amazon Linux 2 and CentOSsudo /usr/sbin/vsftpd /etc/vsftpd/vsftpd.confDebian and Ubuntusudo /usr/sbin/vsftpd /etc/vsftpd.conf