FTP user creation in EC2 Instance - Ubuntu/Linux
Create FTP user for VSFTPD (Very Secure File Transfer Protocol Daemon) server
Prerequisites
Let’s start
Amazon Linux?and?CentOS
sudo yum install vsftpd -y
Ubuntu?and?Debain
sudo apt install vsftpd -y
sudo vi /etc/vsftpd.conf
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.
领英推荐
sudo adduser --home /home/usr_1 usr_1
Note: usr_1 is the username I have created. You can use of your choice
sudo passwd usr_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/
?
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
Restart the vsftpd service:
sudo systemctl restart vsftpd
Connect to the FTP server.