How to install FTP server in CentOS 7
28 Apr

How to install FTP server in CentOS 7

In this article, we will learn how to install and configure FTP server on CentOS 7 or RHEL 7 using vsftpd package. VSFTPD (Very Secure File Transport Protocol Daemon) is a secure and very fast FTP server on Linux systems.

VSFTPD is designed for uploading and downloading the data on server. It helps user to upload and download data from server to client and Client to Server whether user is in Local Area Network or Wide Area Network. VSFTP is a secure, stable, and fast FTP server. It can greatly decrease the chances of an attacker gaining access to a server via FTP exploits.

Server information
Operating System: CentOS 7
Server IP Address:
Package name : vsftpd
configuration file : /etc/vsftpd/vsftpd.conf
Document root : /var/ftp/pub
Service name : vsftpd
FTP Server listen on : 21
Selinux Status : disabled

Client Information
Operating System : Any Windows or Linux
Client IP Address :
Client Software : Filezilla

Check Selinux Status
# getenforce

If Selinux is not disabled in server, follow the steps to disable and reboot the system
# vim /etc/sysconfig/selinux
Change to

Reboot Server if Selinux disabled now
# reboot

Install VSFTPD package on server
# yum install vsftpd -y

List installed package
run rpm command to list the installed package
# rpm -q vsftpd

Start VSVTPD service
# systemctl start vsftpd

Enable service permanently
Once you enable the service it will automatically start service at next system boot.
# systemctl enable vsftpd

Allow FTP port in server firewall
# firewall-cmd –zone=public –permanent –add-port=21/tcp
# firewall-cmd –zone=public –permanent –add-service=ftp
# firewall-cmd –reload

FTP server can be configured in two way.
1. Anonymous configuration – In anonymous method you can browse/access ftp without credentials.
2. User based configuration – In user and based method you require username and password to access the ftp.

Configuring FTP Server
Allow FTP server to access Anonymously, Edit FTP configuration file and enable the below parameter.
# vim /etc/vsftpd/vsftpd.conf
anonymous_enable=YES # This parameter allow Anonymous FTP login and share data from /var/ftp/

Restart service to make configuration update
# systemctl restart vsftpd

Access FTP from Client system
You can access FTP , using ftp command line, Windows Explorer, or any other internet browser or through FileZilla Software.

Open Browser and type URL

Access FTP using Filezilla
Download Filezilla software in Client machine
Access FTP server from Filezilla

How to enable user authentication in VSFTPD / FTP server
Add user and password in server
# useradd ftpuser1
# passwd ftpuser1

# useradd ftpuser2
# passwd ftpuser2

Enable parameter local_enable=YES in config file
# vim /etc/vsftpd/vsftpd.conf

# systemctl restart vsftpd
Access user from Filezilla

Enable user_list file in VSFTPD server
When you enable user_list file with userlist_deny=NO , means only allowed users in this can access FTP server. Add parameter in bottom of configuration file.

# vim /etc/vsftpd/vsftpd.conf
# systemctl restart vsftpd

Add user in userlist
# vim /etc/vsftpd/user_list

How to enable Chroot Jail environment in FTP/VSFTPD server
In system when we create a FTP user by default ftp user can list/access another files within top level directory out from their home directory. Once you enable chroot environment in vsftpd.conf file user can not access another directory except own directory.
User can enter in / directory before chroot enable

Edit vsftpd configig file and enable chroot environment
# vim /etc/vsftpd/vsftpd.conf
#userlist_deny=NO #comment this line
# systemctl restart vsftpd

Login FTP server again

About the Author