How to configure FTP server in Linux

There are many types of services available which can be used to configre FTP server in Linux. In this particular artical I will be showing you the most simple FTP server with least features. As vSFTPD is very fast many rules can be implemented using this server but it depends on the user and requirement.

VSFTPD means Very Secure FTP Daemon where FTP stands for File Transfer Protocol.

To start with the configuration check for the packages required

# rpm -qa | grep vsftpd  
# yum -y install vsftpd  

The details of all the syntax used in the config file have been explained in brief so you can opt for the option as per your requirement

# vi /etc/vsftpd/vsftpd.conf  
(you have to check for all these parameters)  
 Allow anonymous FTP?  
 anonymous_enable=YES  
 #Uncomment this to allow local users to log in.  
 local_enable=YES  
 # Uncomment this to enable any form of FTP write command  
 write_enable=YES  
 #Uncomment this to allow the anonymous FTP user to upload files  
 anon_upload_enable=YES  
 # You may specify an explicit list of local users to chroot() to their home  
# directory. If chroot_local_user is YES, then this list becomes a list of  
# users to NOT chroot().  
#chroot_local_user=YES  
 pam_service_name=vsftpd  
 userlist_enable=YES  
 tcp_wrappers=YES

Restart your service

# service vsftpd restart  

If you want to prohibit few users from logging into the ftp server then add the following parameter in your config file
userlist_deny=YES

# vi /etc/vsftpd/user_list  
user1  
user2  

To change the default login directory of anonymous users .

Add this parameter in vsftpd.conf file

# vi /etc/vsftpd/vsftpd.conf  
anon_root=/path_to_dir  
(Make sure the permission on this directory is proper to be accessible by the required user)  

To change the default login directory for any user on the ftp server as by default the user always logs into his/her home directory.

Add this paramenter in vsftpd.conf

user_config_dir=/etc/vsftpd/vsftpd_user_conf  

save and exit

# cd /etc/vsftpd/  

Create a new file vsftpd_user_conf

# vi vsftpd_user_conf  
local_root=/path_to_directory  

# service vsftpd restart