How to setup VSFTP Configuration
FTP Configuration
Dated : 15/11/2018
File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet over TCP/IP connections.FTP is a client-server protocol that relies on two communications channels between client and server
Step 1 : check whether the ftp is already installed in our server else install this in you server here we are using centos 7 so we installed the application using yum.
Yum install vsftpd
Step 2 : After the installation service will be in disabled state in first we have to start the service and enable the service. Start the service using
systemctl start vsftpd
And enable the service using
systemctl enable vsftpd
Step 3 : To use this ftp service from other system we have to access this through the port 21 so we have to enable the port number 21 in firewalld .
firewall-cmd --zone=public --permanent --add-port=21/tcp firewall-cmd --zone=publ to ic --permanent --add-service=ftp
After open the port in firewalld don’t forget to reload the firewalld using
firewall-cmd --reload
After the firewalld reload don’t forget to check whether the port is LISTENING or not using
netstat -plnt | grep LISTEN
Step 4 : Now we are going to make some changes on the configuration file to setup and secure our FTP server.Open the config file in the location of /etc/vsftpd/vsftpd.conf
Note: If you want to change anything on the config file before that don’t forget to took backup of that config file if anything goes wrong after we made changes on the config file we will replace the backup into the config file else it will create a big problem in your server.
Made these changes on the vsftpd.conf file
anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES xferlog_enable=YES connect_from_port_20=YES xferlog_enable=YES listen=NO listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES
Step 6 : Then go to the location of /etc/vsftpd/user_list Here you have to enable the userlist_deny=NO
this will enable the username with in the file other users are denied.
And then add the following lines in the user_list:
chroot_local_users=YES
allow_writable_chroot=YES
Step 7 : Restart the vsftpd service
systemctl restart vsftpd
Step 8: Test the ftp server using create the new user
useradd -m -c “newusername” -s /bin/bash newusername
passwd newuserpasswd
Step 9 : Add the new user name to the userlist to access the ftp.
echo "newusername" | tee -a /etc/vsftpd.userlist
Make sure that created username have been added in user list, otherwise that user cannot access FTP.