Tutorial

How To Set Up vsftpd on CentOS 6

Published on June 19, 2012
How To Set Up vsftpd on CentOS 6

Status: Deprecated

This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.

Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.

About vsftpd

Warning: FTP is inherently insecure. If you must use FTP, consider securing your FTP connection with SSL/TLS. Otherwise, it is best to use SFTP, a secure alternative to FTP.

The first two letters of vsftpd stand for "very secure" and the program was built to have strongest protection against possible FTP vulnerabilities.

Step One—Install vsftpd

You can quickly install vsftpd on your virtual private server in the command line:

sudo yum install vsftpd

We also need to install the FTP client, so that we can connect to an FTP server:

sudo yum install ftp

Once the files finish downloading, vsftpd will be on your VPS. Generally speaking, the virtual private server is already configured with a reasonable amount of security. However, it does provide access to anonymous users.

Step Two—Configure VSFTP

Once VSFTP is installed, you can adjust the configuration.

Open up the configuration file:

sudo vi /etc/vsftpd/vsftpd.conf

One primary change you need to make is to change the Anonymous_enable to No:

anonymous_enable=NO

Prior to this change, vsftpd allowed anonymous, unidentified users to access the VPS's files. This is useful if you are seeking to distribute information widely, but may be considered a serious security issue in most other cases. After that, uncomment the local_enable option, changing it to yes.

local_enable=YES

Finish up by uncommenting command to chroot_local_user. When this line is set to Yes, all the local users will be jailed within their chroot and will be denied access to any other part of the server.

chroot_local_user=YES

Finish up by restarting vsftpd:

sudo service vsftpd restart

In order to ensure that vsftpd runs at boot, run chkconfig:

chkconfig vsftpd on

Step Three—Access the FTP server

Once you have installed the FTP server and configured it to your liking, you can now access it.

You can reach an FTP server in the browser by typing the domain name into the address bar and logging in with the appropriate ID. Keep in mind, you will only be able to access the user's home directory.

ftp://example.com

Alternatively, you can reach the FTP server through the command line by typing:

 ftp example.com

Then you can use the word, "exit," to get out of the FTP shell.

By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

When add a new user:

adduser userftp

passwd userftp

You can disable the login ssh with and just for ftp:

usermod -s /sbin/nologin userftp

Regarsd

Etel Sverdlov
DigitalOcean Employee
DigitalOcean Employee badge
January 10, 2013

It will be your existing server user

what will be the ftp username and password for this setup?

Etel Sverdlov
DigitalOcean Employee
DigitalOcean Employee badge
October 30, 2012

Hi Sudsachin, that’s a great suggestion! I will build out the article further in the coming days. Thanks!

sudo service vsftpd restart

Starting vsftpd for vsftpd: [FAILED]

what to do?

i have followed all steps but when i try to ftp i got error

[root@lhr ~]# ftp 155.254.34.217 ftp: connect: Connection refused ftp> exit [root@lhr ~]# find / -name test_file [root@lhr ~]# ftp lhr.cybershells.net ftp: connect: Connection refused ftp>

also in browser it ask login pass again and again

Hi Etel! You have great articles! Did you post how to setup users and their directories? Plese send me the link. Thanks!

this really help me

Stupid question, but where can i find the command line “You can quickly install vsftpd on your virtual private server in the command line:” ?

is it console? if so it asks me for login and password, which login and password should i input?

etel,

im getting below error via filezilla

response: 550 Failed to change directory. Error: Failed to retrieve directory listing

can you help me

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more