How to Install, Configure and Secure FTP Server in RHEL 8
FTP (stands for “File Transfer Protocol”) is a standard and old network protocol used for the transfer of files between a client and server on a computer network. It is built on a client-server model architecture, which offers access to files and directories via an FTP client, to upload files to the server as well as download files from it.
In our previous article, we have explained how to install, configure and secure FTP Server in CentOS/RHEL 7 for the transfer of computer files between a client and server on a computer network.
In this article, we will describe how to install, configure and secure an FTP server on RHEL 8 for basic file sharing between computers.
Install FTP Server on RHEL 8
1. To install secure FTP package, use the following dnf command.
2. When the installation is complete, you need to start the vsftpd service for the meantime, enable it to start automatically at system boot and then verify the status using the following systemctl commands.
3. Next, you need to open FTP port 21 on the system firewall to allow access to FTP services from external systems.
Configure FTP Server on RHEL 8
4. To configure an FTP server, you need to take the backup of the main FTP configuration file /etc/vsftpd/vsftpd.conf
using the following copy command.
5. Then open the configuration file using your favorite command line editor.
Set the following parameters with these corresponding values (see man vsftpd.conf for meanings of the configuration parameters):
6. Next, you need to configure FTP to allow/deny users access to FTP services based on the user list file /etc/vsftpd.userlist.
By default, users listed in /etc/vsftpd.userlist
file are denied access with the userlist_deny
option set to YES
, if userlist_enable=YES
, it enables access.
But, setting the parameter userlist_deny=NO
alters the setting, meaning that only users explicitly listed in userlist_file=/etc/vsftpd.userlist
will be permitted to log in.
Therefore, add the following lines in your vsftpd.conf
configuration file (or if there already exist, uncomment them and set their values as shown):
7. Now add the following lines in your vsftpd.conf
configuration file to restrict FTP users to their Home directories.
Save the changes in the file and close it.
8. Set the following SELinux boolean rule to enable FTP to read/write files of user’s home directory.
9. Finally restart the vsftpd service to affect all the changes we made so far above:
Testing FTP Server on RHEL 8
10. To test if the above FTP setup is running fine, start by creating an FTP user with useradd command and create a password for that user.
11. Then add the user tecmint to the file /etc/vsftpd.userlist using the echo command as follows.
12. Then create the alternative local root directory for the user (tecmint, yours is probably different) and set the appropriate permissions on this directory.
13. Next, create a directory inside the local root location, where user’s will keep his/her files.
14. Now connect to the FTP server using any FTP client as follows.
Sample Output
That’s it! In this article, we described how to install, configure as well as secure an FTP server in RHEL 8. In our next article, we will show how to secure FTP server using SSL/TLS connections. Until then, stay with us.
Tidak ada komentar:
Posting Komentar