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.

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 Truncate SQL 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 Trun...
How to Setup FTP Server in Windows 10? FTP (File Transfer Protocol) is a popular Internet data transfer protocol. You can use FTP to transfer files between a remote server and a local PC. F...
Renaming a Computer with SQL Server Instance After SQL Server installation internal SQL Server is based on the host computer name. However, when you are changing the host name, old SQL server nam...
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 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 2016 /2012 R2. Also we will show you how to cre...

Add Your Comment