CentOS / Red Hat Linux Install VSFTPD FTP Server

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.

ADVERTISEMENTS

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

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
16 comments… add one
  • chika May 22, 2008 @ 22:29

    ho3…

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

  • sky Jun 11, 2008 @ 7:18

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

    • Tanmoy Jun 10, 2015 @ 14:51

      # service iptables stop
      # chkconfig iptables off
      # yum install vsftpd* -y
      # vim /etc/vsftpd/vsftpd.conf
      remove a # from this line (chroot_local_user=YES)
      add the line in last end.. (userlist_deny=NO)
      # vim /etc/vsftpd/user_list
      add the user for ftp access
      # setsebool -P allow_ftpd_full_access on
      # service vsftpd restart
      # chkconfig vsftpd on

  • sankar Mar 6, 2009 @ 10:02

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

  • ketan Apr 28, 2009 @ 14:11

    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

  • Juddling Jun 9, 2009 @ 13:07

    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 :)

  • Ying Mar 15, 2010 @ 14:40

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

  • Tahir Mehmood Feb 21, 2011 @ 9:30

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

  • Flenix Oct 22, 2011 @ 9:19

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

  • martin Nov 22, 2011 @ 17:08

    Quick, simple, elegant article – thanks.

  • Paul Jan 6, 2012 @ 15:59

    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.

  • asep Mar 19, 2012 @ 14:55

    Thank for your information…….

  • Jeremy Jul 29, 2013 @ 17:38

    Awesome, worked perfectly on my new Centos server through Godaddy… FTP was already installed so all I needed to do was ‘start’ the server and boom I opened FileZilla and it immediately connected.

    Thank you for this resource

  • vimal Aug 26, 2013 @ 6:12

    Can anyone please share me the limk to download RHEL WS 4 Update1 iso’s……!!!!!! please urgent !!!!!!!

  • Bob Sep 5, 2013 @ 6:48

    Getting the server setup is one thing, and thanks for a great article on how to accomplish it. But, now, how do we add users and drop them into specific directories?

  • kubrick Feb 26, 2014 @ 9:39

    To start working the service under CentOS, I’d add the following command (as ‘root’):
    $ setsebool -P ftp_home_dir=1

    Without it, the servide did not work for me…

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.