How to Install and configure FTP server with user-based authentication in centos 7/8 , Redhat 7/8 , Fedora
Ftp is one of the best way to share files over the network. We can setup user-based authentication to secure our FTP server from unwanted access.In this blog we are going to user vsftp( very secure file transfer protocol ) to setup user-based authentication on our FTP server.
1) Install the VsFtp (Very Secure File Transfer Protocol) Package :-
2) Open the configuration file of vsftp server and disable anonymous access by default ftp is set to anonymous access.
press i to get into insert mode
# Example config file /etc/vsftpd/vsftpd.conf
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd’s
# Allow anonymous FTP? (Beware – allowed by default if you comment this out).
# Uncomment this to allow local users to log in.
# When SELinux is enforcing check for SE bool ftp_home_dir
# Uncomment this to enable any form of FTP write command.
#Add the following parameters in the end of the file. this parameters will provide security to your FTP server. In such a way that the FTP user will only be able to browser the FTP directory only
after making changes in the file press escape from keyboard and press :wq! to write and quite from file.
3) Creating user for FTP access.
4) Start and enable the service.
systemctl enable vsftpd
5) Apply the firewall rule
6) Open your browser
ftp://<your_ip> and pass your user credentials .
Our Ftp server is up and running now we will upload file to it to share.
The home directory of ftpuser is /home/ftpuser
so here we need to upload file here to share. copy or put your file to /home/ftpuser to share.
After you upload file to /home/ftpuser make sure you set the SELinux context also as in redhat, centos, fedora by default SELinux is enforcing. the SELinux context for the FTP file share is “public_content_t”. you can just run the following command to update the context on the uploaded files.
We have configured FTP server successfully.
Now, let’s move to the client side.
The Clients in the server network can access the FTP server just by opening their web server and searching FTP:// and passing the username and password
or the Clients can even access it by CLI (terminal) by installing FTP client package.
After we install the FTP client package we can access the FTP server by terminal.
Connected to 192.168.122.154 (192.168.122.154).
220 (vsFTPd 3.0.2)
331 Please specify the password.
Password: pass the password of FTP user
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
227 Entering Passive Mode (192,168,122,154,54,89).
150 Here comes the directory listing.
226 Directory send OK.
For more detailed Explanation Watch our YouTube Video