[Guide] Setup FTP Server & Complete Configuration on Centos

I am back again with a new article. This time I am going to explain you how to setup FTP centos with all of its options. FTP server is one of the most useful product for web servers as we usually need to upload and download files from the server. In absence of graphical control panels like cPanel, it becomes difficult to upload data so best product available for this is FTP server.
Installing and configuring FTP server on centos is one of the easiest process if you get the logic of whats happening & what you are required. Basic profile of FTP Server is as below.
Server: FTP
Service Name: VSFTPD
Port: 21 / 20 ( 21 – Connection Port / 20 – Data Transfer Port)
Config File: /etc/vsftpd/vsftpd.conf
Log File: /var/log/xferlog

How to Install FTP Server: 

Installation of FTP server is very simple. Command for installing is as below.

# yum -y install vsftpd

After completion of all work, your vsftpd server is installed now. Now we have to start the FTP service as we did in Apache Server.

# service vsftpd start

You will get message as shown below showing FTP server is running.

Starting vsftpd for vsftpd:                                                [ OK ]

By default your FTP server is active and now you can connect to your FTP server using your local username and password. All users on the linux machine with valid username and password can access their home directories as well as download and upload content in their home directories. Create new users and set them password, they would also be able to access their home directories.
There are certain options in the FTP servers which you can avail as per your requirement. Options are listed below as:

  • Allowing Anonymous user to view read or write content
  • Completely block Anonymous user
  • Allowing local user to view all Linux content
  • Blocking local user to home directory only
  • Blocking local user from FTP access
  • Blocking Specific User FTP Access

First of all sort of configurations are possible but only from the config file mentioned in the basic profile of the article. You will find all type of options in the config file just you have to understand their working and modify them according to your requirements.

  1. Anonymous user Enable/Disable 

Open your configuration file and find the link given below.
anonymous_enable=NO
Changing this to YES or commenting this line will enable local user access. Local user can only access pub folder. Now if you want to enable anonymous user to upload content or allow anonymous user write access you have to uncomment below lines.
#anon_upload_enable=YES
#anon_mkdir_write_enable=YES
Removing number sign from start will uncomment these lines and will allow users to upload as well as delete data from pub folder.
By Default anonymous user is disabled and as a security precaution we suggest to keep in disable unless otherwise you know what you are doing and its impact.
2. Allowing/Blocking Local User to Access All Linux Files:
Local User is allowed to access only home folder by default. You need to allow local user to access all files and folder on linux including root folder and system files. There is an option known as “chroot” in Linux which is known as Jail in FTP. If you enable this option all users FTP access will be restricted to their root folder meant as Jail for local user. Disabling this option or commenting out chroot line will open the boundaries. Below line will allow you to do your desired task.
chroot_local_user=YES
Just place a number sign “#” in the start of the to release the local user jail.
3. Blocking All User / Specific User from FTP Access:
Last not the least option is blocking all users from FTP access which is normally not required. However, if you in such a situation that you want to temporarily block all users than find out the below mentioned line in config file.
local_enable=YES
Comment out this line and no local user can access FTP server. FTP server is running but local users are not allowed to access even their home directory. If you need some specific users access blocked to FTP then option is simple but a little bit different.
#chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
Remove number sign from the start of these two lines and update chroot_list file. Add as many user names as you need. All users in this list will be blocked from FTP access. Already you will find some users listed in the chroot_list file but you can add or remove users in the list to block or allow access.
If you feel any issue in settings or need some further information. Do drop us a message in comments and we would be happy to help you out.