Create FTP user for VSFTPD (Very Secure File Transfer Protocol Daemon) server

Prerequisites

  • AWS console access
  • EC2 Instance access

Let’s start

  • We need to install VSFTPD package if you have already installed then you can skip the installation steps.

Amazon Linux and CentOS

sudo yum install vsftpd -y

Ubuntu and Debain

sudo apt install vsftpd -y

  • Now we need to modify the configuration file created by vsftpd as below

    • You can get the conf file at /etc/vsftpd/vfstpd.conf in Amazon linux and Centos

    • And for Ubuntu and Debian the conf file is located at /etc/vsftpd.conf

  • Once you get the file location you can edit the using vi or vim editor as below

sudo vi /etc/vsftpd.conf
  • Change the variables in the conf file as needed for your environment
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=NO
xferlog_std_format=YES
chroot_local_user=YES
allow_writeable_chroot=YES
chroot_list_file=/etc/vsftpd/chroot_list
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
listen_port=8021
pasv_enable=YES
pasv_min_port=8000
pasv_max_port=8050
pasv_addr_resolve=YES
pasv_address=yourdomain.com - replace it with our domain

Important:

The default FTP port is 21. I have configured the custom FTP port 8021 in the above configuration file. You can configure the value of your own choice and make sure you that you listen_port is not commented and set connect_from_port_20 to NO. And also verify that the port that you are using is also active in your firewall and added in the Security Groups.

  • Now Run the following command to add the FTP use
sudo adduser --home /home/usr_1 usr_1

Note: usr_1 is the username I have created. You can use of your choice

  • Run the following command to create a password for the user:
sudo passwd usr_1
 
  1. Run the following command to change the ownership of the /home/usr_1 file. This command makes usr_1 the file owner.
sudo chown usr_1:usr_1 -R /home/usr_1/
 
  1. 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 CentOS

sudo echo "usr_1" | sudo tee -a /etc/vsftpd/user_list

Debian and Ubuntu

Run the following command to create the userlist file and add the new user to the file:

sudo echo "usr_1" | sudo tee -a /etc/vsftpd.userlist
  1. Restart the vsftpd service:
sudo systemctl restart vsftpd
  1. Connect to the FTP server.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *