File Transfer Protocol (FTP) is one of the easiest to use, and most convenient. To transfer a file using the FTP protocol, a user must log in to an FTP server, which can be done with credentials or anonymously.
If the protocol is not configured properly, this can leave your entire system open to attack and hard to track if the attack is done through an anonymous connection. Moreover, the FTP protocol is that when the user logs in with a username and password, they are passed over the network in clear-text. So, we need to configure a secure protocol to protect your data and organization.
1. Install an FTP Server (Use Very Secure FTP Daemon - vsftpd)
# yum install -y vsftpd
2. Configure FTP Server (/etc/vsftpd/vsftpd.conf)
3. Configure Firewall and SELinux
# iptables -I INPUT -p tcp -m tcp --dport 20 -j ACCEPT
# iptables -I INPUT -p tcp -m tcp --dport 21 -j ACCEPT
# setsebool -P ftpd_disable_trans=1
4. Connect To FTP Server
Beside, you can use alternatives applications such as Gnome Commander (Linux) or Total Commander (Windows) to connect to your FTP server.
5. Secure FTP Server
The FTP protocol supports two different types of file transfer. The first is known as active mode, which uses port 20 to connect back to the client. The second is known as passive mode, which uses a custom-defined range of ports above 1024. By default, active mode is used for the vsftpd service.
Step 1. Disable the anonymous_enable option to prevent non-authorized users from accessing the FTP Server.
# anonymous_enable=NO
Step 2. Restrict users from accessing the FTP Server using userlist_enable option (user_list & ftpusers).
Step 3. Change default folder
Step 4. Create Multi FTP Site
For example, I want to create one more IP address for anonymous user and the other for local user to log in.
Now we create one more config file for the new one.
Have fun!