Cent OS

How to Install and Configure vsFTPd on CentOS 7

This time we will take a look on how we can set up vsFTPd FTP server on CentOS 7. FTP will be useful for every organization and services, for example to manage your website or use it like a downloadable data storage for clients.

So let`s start. The first thing we need to do is to install all vsftpd packages:

sudo yum -y install vsftpd

After that, we need to backup configuration file. This gives you an opportunity to restore configurations to default at any time:

sudo mkdir /backup
sudo cp /etc/vsftpd/vsftpd.conf /backup

Now let`s install an FTP client on your computer — maybe we will need it during configuration check later. It`s very easy to install:

sudo yum -y install ftp

Configuring vsFTPd server

After that let`s configure vsftpd. The important thing is that Anonymous login is enabled by default. We recommend you to disable it using anonymous_enable=NO, this will help you to make your FTP server more secure.

To set up vsftpd we need to edit configuration file vsftpd.conf:

sudo nano /etc/vsftpd/vsftpd.conf

Let`s make some corrections in this file:

Option Description
anonymous_enable=NO Disallow anonymous login
local_enable=YES Allow local users login
write_enable=YES Gives a permission to user to write to a file
connect_from_port_20=NO Disallow 20 port
chroot_local_user=YES Chroot all users
local_umask=022 Install 022 mask. This will make us sure that all 644 files and 755 folders we are downloading has the rights we need.
READ ALSO  How to Setup an FTP Server in Windows 10

This will be enough to run your FTP server. To get an extended info about current parameters — use man (man vsftpd.conf).

Add new FTP user

Now let’s create FTP user with ftpuser name and /var/www/your_catalogue home folder:

useradd -d ‘/var/www/path/to/your/dir’ -s /sbin/nologin ftpuser

Create password:

passwd ftpuser

If ftpuser home folder does not exist, make it now:

mkdir -p /var/www/path/to/your/dir

To allow user to read and write a file in his home folder, we need to change the rights:

chown -R ftpuser ‘/var/www/path/to/your/dir’
chmod 775 ‘/var/www/path/to/your/dir’

Now let’s create ‘ftpusers’ group for FTP users and add ‘ftpuser’ in it:

groupadd ftpusers
usermod -G ftpusers ftpuser

Set up iptables for vsFTPd

Now we need to configure IPTABLES and add rules for FTP.

Let’s open configuration file iptables and make some corrections:

sudo nano /etc/sysconfig/iptables
 -A INPUT -m state —state NEW -m tcp -p tcp —dport 21 -j ACCEPT

Save and close the file. Now reset your firewall by running command:

sudo systemctl restart iptables

Set up vsFTPd autorun after boot

chkconfig —levels 235 vsftpd on

Let’s start vsFTPd FTP service:

service vsftpd start

Now everything is ready and FTP configuration is finished. Let’s check if everything goes fine:

ftp localhost
 Connected to localhost (
 220 (vsFTPd 2.2.2)
 Name (localhost:root): ftpuser
 331 Please specify the password.
 230 Login successful.
 Remote system type is UNIX.
 Using binary mode to transfer files.

You may also like:

How to Install and Configure DNS Server on Windows... This article is a step by step tutorial on how to install and configure a DNS Server on Windows Server 2012. MS Windows Server 2012 is a great and ...
How to Truncate SQL Server 2012 Transaction Logs Transaction logs in SQL Server 2012 tend to grow over time, which can sometimes fill all your available disk space. To avoid this, SQL Server has a lo...
How to Setup an FTP Server in Windows 10 Today we will show you how to setup and access an FTP server in Windows 10. At first let’s create an FTP folder. This folder will be accessed by our F...
How to Install and Configure IIS Web Server with P... This guide will show you how to deploy your own IIS Web server, and enable it to run PHP on Windows 8 / Windows Server 2012. Thereafter this platform ...
How to create your own Cloud Storage Server In this tutorial, we are going to show you how to create your own cloud storage server. Head over to http://www.cloudways.com/ and click on Free Tr...