Linux Administrator

How To Setup FTP Server On CentOS 7 (VSFTP)

Setup-FTP-Server-on-Centos
mm
Written by Santosh Prasad

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.

Thanks:)

Thank you! for visiting Look Linux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at Look Linux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment