How Do You Set up an FTP Server on an RHEL Server Running in AWS?

Problem scenario
You want to use a Red Hat Enterprise Linux server to be an FTP server.  You have a RHEL instance in AWS.  How do you configure this server to serve as an FTP server?

Solution
1.  Run this command: sudo yum -y install vsftpd

2.  Run the commands below but replace contint with the username of your choice.  You will need to respond to a password prompt too.

sudo adduser contint
sudo passwd contint # give this user a password and remember it
sudo mkdir /home/contint/ftp
sudo chmod a-w /home/contint/ftp
sudo mkdir /home/contint/ftp/files
sudo chown contint:contint /home/contint/ftp/files
echo "file to test vsftpd" | sudo tee /home/contint/ftp/files/basic.txt

3.  Edit the /etc/vsftpd/vsftpd.conf file so that

    a) "chroot_local_user=YES" is not commented out.  (There should be no leading "#" in front of this stanza.)

    b) these lines are appended at the bottom (and then save the changes to vsftpd.conf):

user_sub_token=$USER
local_root=/home/$USER/ftp
pasv_min_port=40000
pasv_max_port=50000

4.  Run these two commands (where contint is the username that was added in step #2):

echo "contint" | sudo tee -a /etc/vsftpd/vsftpd.userlist
sudo systemctl restart vsftpd

Leave a comment

Your email address will not be published.