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.
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.
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.
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
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.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
Former Director of Community at DigitalOcean. Expert in cloud topics including LAMP Stack, CentOS, Ubuntu, MySQL, SSL certificates, and more.
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!
You may want to add “chkconfig vsftpd on” to the end, otherwise when the server/VPS is rebooted, no user will be able to log-in until vsftpd is started from CLI.
Thanks for the addition—I have updated the article to include chkconfig!
Nice Tutorial! But please add how to setup users and their default path or directory of access.
Hi Sudsachin, that’s a great suggestion! I will build out the article further in the coming days. Thanks!
Etel,
I’m really liking digital ocean tutorials.
I was hoping you could create a tutorial on how to install virtualization and get it started via CentOS 6.3
Can you save me? :)
If you are running virtualization inside of a virtual server from DigitalOcean you will most likely not be able to bridge the connection because the server is already virtualized and running through the hypervisor.
Or is this on a dedicated system.
You should be able to get a dedicated server to be setup as a hypervisor with KVM installed on it - however the networking bridge can also be affected on your network setup from the switch that your server is connected to.
Best thing to do is contact your dedicated server provider and see if they can provide you a bit of guidance in getting this setup.
When add a new user:
You can disable the login ssh with and just for ftp:
Regarsd
Thanks Etel and Gildus, Now I already created an ftp login and I was able to successfully login using filezilla, but I cannot upload files beacause I do not see var/www/html folder
That sounds like a user path issue, what you could do is upload a file like: test_file
Then login to the system as root and see where that file is located: find / -name test_file
Then you will see where that user is logging in if it’s not displayed when you issue the PWD command inside of FTP and you can review your user’s home directory accordingly.
Just signed up after a year with another cloud provider. Going to miss their support, but their cloud options are just not performing the way we need them to. Problem now is I have to set up this server and man I’m having issues. Would be a great start to learn how to set up users and passwords jailed to a directory. My goal right now is to get a test installation of Wordpress to update plugins via ftp, but not working. Final goal is to run Magento using Nginx here on DO.
Easiest way to do jailing is to restrict SSH access for all new users so that they only have FTP access, you can do that by modifying their “shell” to something like /sbin/nologin.
Then move forward step by step from there.
Ok I am really loving these articles. Concise, to the point and they work. This article is a great example. Yes I have installed FTP servers and VSFTPD before. However these articles point me in the right direction and help me avoid previous pitfalls. Last time VSFTPD was a schlepp. This time a breeze!
rock on
Thank you, Ed! Thank you so much for your kind comment! It’s really appreciated =]
I agree these articles are great. However, I am not able to connect via FTP after following these instructions.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.