How To Install and Configure VSFTPD Server On CentOS 8 / 7

We can install and configure vsftpd server on CentOS 8 /7. you can install and configure the FTP server in Linux. 

How To Install and Configure VSFTPD Server On CentOS 8 / 7

We can install an FTP server on the Linux machine. you don’t need to add any repository. we will get this package in the default yum repository. Run the below command to install. 

sudo yum install vsftpd -y

Check Out: How To Enable Root Login On Ubuntu Focal 20.04 / 18.04

Now it’s installed. 



1. We need to start and enable the FTP server service with the below commands.  

[root@ftp ~]# sudo systemctl start vsftpd && systemctl enable vsftpd
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/vsftpd.service.

2. It’s good to have a backup of an original file of the vsftpd server. you can take backup using the below commands.

cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf-back

We will also open the port/service in the firewall rules using the following commands.

For CentOS 7 /8:

firewall-cmd --permanent --add-port=21/tcp
firewall-cmd --reload

For CentOS 6:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT

Check Out: How To Install Prometheus Monitoring Tool On Linux

Now restart the iptables.

service iptables restart

3. Now open the vim /etc/vsftpd/vsftpd.conf file to make changes. you can uncomment the below parameters in the file. 

ftpd_banner=Welcome to blah FTP service.

chroot_list: We have enabled this file because when you create an FTP user in the Linux server. the user will be able to access all the other files until you don’t enter the name of the server in this file. It will restrict to access the other files rather than user home directory.

Check Out: How To List Git Remote Branches of Repository From Github

Create this file if it does not exist at the below location.

touch /etc/vsftpd/chroot_list

We need to restart the FTP server service and you may check the port 21 must be listening.

[root@ftp ~]# netstat -tnlp | grep vsftpd
tcp6     0    0    :::21     :::*       LISTEN          14658/vsftpd

How To Give Access To User for a particular folder:

1. We need to create an FTP user with a custom directory. you can create a user and set the password using the below commands. 

[root@ftp ~]# useradd fusr
[root@ftp ~]# passwd fusr
Changing password for user fusr.
New password: 
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: 
passwd: all authentication tokens updated successfully.

2. Create a directory and make the owner and group to the user. 

mkdir -p /var/www/html/ftpdata
chown -R fusr:fusr /var/www/html/ftpdata

Modify the user’s home directory and assign the directory to the user as default.

usermod -d /var/www/html/ftpdata fusr

Check Out: How To Install Firejail and Run Unsecure Application On Linux

3. We can check the information about the user with the below command as shown. 

[root@ftp ~]# grep fusr /etc/passwd

If you want to perform only FTP operation with this user, you can change its shell to /sbin/nologin

usermod -s /sbin/nologin fusr

4. Test whether you’re able to login with this user. Open a terminal and run the below commands. 

abc@757:~$ sudo ftp
[sudo] password for aryan: 
Connected to
220 Welcome to blah FTP service.
Name ( fusr
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.

As you can see. we’re able to log in to the FTP server from a remote location using the above command. it will ask you the username and password of the FTP user.

Now we will create a file inside the directory and see whether we’re able to get that file or not. 

touch /var/www/html/ftpdata/abc.txt

Check Out: Install Samba Server and Configure On Ubuntu 20.04/19.10

Login to the server using the credentials and run the ls command to see the data. you can see. we have got a file which we’ve created inside that directory. 

ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
-rw-r--r-- 1 0 0 0 Aug 07 18:19 abc.txt
226 Directory send OK.

How To Access FTP Using Filezilla or WinSCP:

We will test it from Filezilla or Winscp software whether we’re able to login using those credentials. Open the Filezilla and put those credentials.

you will have to use port 22 in the Filezilla because you won’t get connected with port 21. it will use the SFTP protocol which is secured. 

configure ftp server linux

Click on “Ok“. Now you will be directly login to your home directory as you can see below.

linux ftp server

We’ve successfully configured the FTP or install vsftpd server on CentOS Linux. In a similar way, you can access the server using the WinSCP.

That’s it.

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment