CentOS / Red Hat Linux Install VSFTPD FTP Server

by Vivek Gite on May 12, 2008 · 10 comments

Q. How do I configure and install an FTP server in CentOS / RHEL 5 / Fedora Linux server?

A. CentOS / RHEL server comes with vsftpd which is the Very Secure File Transfer Protocol (FTP) daemon. The server can be launched via a xinetd or as standalone mode, in which case vsftpd itself will listen on the network port 21.

How do I install vsftpd?

Simply type the following command as a superuser (root):
# yum install vsftpd

WARNING! These examples open your computer to insecure ftp protocol. If possible use SFTP ftp secure sever which is inbuilt into OpenSSH SSHD server.

Turn on vsftpd ftp service

Type the following command:
# chkconfig vsftpd on

How do I start vsftpd ftp server?

Type the following command:
# service vsftpd start

How do I stop vsftpd ftp server?

Type the following command:
# service vsftpd stop

How do I restart vsftpd ftp server?

Type the following command:
# service vsftpd restart

Open FTP port

Open /etc/sysconfig/iptables file, enter:
# vi /etc/sysconfig/iptables
Append following line to open ftp port 21 before REJECT line:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 21 -j ACCEPT
Save and close the file. Restart the firewall:
# service iptables start

Test ftp server

Type the following command:
$ ftp localhost
$ ftp ftp.server.com
$ ftp 202.54.1.1

How do I configure vsftpd server?

The default configuration file is /etc/vsftpd/vsftpd.conf file. You can open file with vi text editor:
# vi /etc/vsftpd/vsftpd.conf
See see vsftpd.conf man pages for all configuration options.
$ man vsftpd.conf

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 10 comments… read them below or add one }

1 chika May 22, 2008

ho3…

how about proftpd vs vsftpd?
i wanna install this kind of application soon…

Reply

2 sky June 11, 2008

pls send the details…. configuration of ftp server in linux

Reply

3 sankar March 6, 2009

here mentioned only iptables concept. I may except /etc/vsftpd/vsftpd.conf

Reply

4 ketan April 28, 2009

when we create yum server that time we use cmmand
cp -dpr * /var/ftp/pub
i want to ask that why we copy that in /var/ftp/pub and what we copy

Reply

5 Juddling June 9, 2009

I had to add this to my /etc/vsftpd/vsftpd.conf:

pasv_min_port=12000
pasv_max_port=12003

And the firewall exception:

-A RH-Firewall-1-INPUT -p tcp -m tcp -m state –dport 12000:12003 –state NEW -j ACCEPT

But it all works now :)

Reply

6 Ying March 15, 2010

File size for FTP
Can we limit file size for FTP ? Download/upload not over 2 MB size ? or something like that ?

Reply

7 Tahir Mehmood February 21, 2011

simple and to the point article, very useful for beginners. thaks.

Reply

8 Flenix October 22, 2011

This guide is sort of useless. Could you not tell us the expected output, so we know we’ve done it right?

Reply

9 martin November 22, 2011

Quick, simple, elegant article – thanks.

Reply

10 Paul January 6, 2012

Great article. It contains everything i needed. While other locations contained some important information, the information that really saved me was the allowing of port 21 through the firewall, since most OS don’t have it as a default.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 7 + 11 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: