Repository Clean:
yum clean all
Disable SELinux Temporarily:
setenforce 0
Change SELinux Configuration Permanently:
sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
Install Vsftpd Package:
yum install vsftpd -y
Create Web Root Directory:
mkdir -p /var/www/html
Create Users with Home Directory and Set Password:
Replace your_plain_text_password with the actual plain text password.
echo "your_plain_text_password" | passwd --stdin user1
echo "your_plain_text_password" | passwd --stdin user2
Grant User Access to /var/www:
setfacl -m u:user1:rwx /var/www
setfacl -m u:user2:rwx /var/www
setfacl -R -m u:user1:rwx /var/www
setfacl -R -m u:user2:rwx /var/www
Vsftpd Configuration Adjustments:
sed -i 's/^anonymous_enable=.*/anonymous_enable=NO/' /etc/vsftpd/vsftpd.conf
sed -i 's/^listen=.*/listen=YES/' /etc/vsftpd/vsftpd.conf
sed -i 's/^listen_ipv6=.*/listen_ipv6=NO/' /etc/vsftpd/vsftpd.conf
Editing the Vsftpd Configuration File:
cat <<EOT >> /etc/vsftpd/vsftpd.conf
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd/chroot_list
pasv_promiscuous=YES
pasv_max_port=24200
pasv_min_port=24000
pasv_address=SERVER_LIVE_IP
EOT
Creating Chroot List:
cat <<EOT > /etc/vsftpd/chroot_list
user1
user2
EOT
Restart and Enable Vsftpd Service:
systemctl restart vsftpd
systemctl enable vsftpd
Update Firewall Settings:
If you're using Firewalld and want to allow FTP traffic and passive ports, you can use the following commands:
firewall-cmd --add-service=ftp --permanent
firewall-cmd --add-port=60000-60100/tcp --permanent
firewall-cmd --reload
Please replace placeholders like your_plain_text_password and SERVER_LIVE_IP with actual values before execution.