How to Install and Configure vsftpd on CentOS 7

How to Install and Configure vsftpd on CentOS 7

FTP server is used to transfer file between computers over network. In this tutorial I will guide you how to setup ftp server on CentOS. This guide contains configuration steps for both ftp and vsftp as well as user creation. In this article I have used VSFTP package which is secure and less vulnerable

Configure FTP Server

Step #1: First update your repository and install VSFTPD package on server.

# yum check-update
# yum install vsftpd -y

Step #2: After installing you will need to edit /etc/vsftpd/vsftpd.conf file which is the main configuration file for VSFTPD. Please take backup vsftpd.conf file before making any changes.

# mv /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.org

Now open and edit file like below.

Find this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.

# vim /etc/vsftpd/vsftpd.conf

anonymous_enable=NO

Uncomment the below line ( Line no : 100 ) to restrict users to their home directory.

chroot_local_user=YES

Enable passive mode and allow chroot writable.

allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100

Step #3: Now restart vsftpd service.

# service vsftpd restart

Step #4: Allow FTP service in firewall to allow ftp ports.

# iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
# iptables -A INPUT -p tcp -m tcp --dport 21 -j ACCEPT

Step #5: Setup SEinux to allow ftp access to the users home directories .

# setsebool -P ftp_home_dir on

Step 6: Now create an User for ftp access. Here /sbin/nologin shell is used to prevent shell access to the server .

# useradd -m sagar -s /sbin/nologin
# passwd sagar

Now user sagar can able to login ftp on port 21.

That’s all!!
 
Enjoyed this video?
How to Install and Configure vsftpd on CentOS 7
"No Thanks. Please Close This Box!"