Hello all !! Hope that you are all well by the grace of almighty. Today we’ll enjoy configuring the setup ftp server linux.
Generally, FTP server can be configured using different types of software in Linux such as Samba server, ftpd, vsftpd. Here in this post we’ll mainly learn how to setup ftp server linux using vsftpd.
Setup ftp server linux
Generally FTP server is used for transferring file as FTP stands for File Transfer Protocol. So to communicate between a server and a network, a FTP server is necessary. We’ll configure FTP server in Linux. The steps shown here can be used in both CentOS and RedHat. I’ve shown the steps here is experimented in CentOS 7. So lets start it.
At first you need open the command terminal. Then need to log in as root user. See, here I’ve logged as root user:
[ece@localhost Desktop]$ su root
Password:
Now after doing that, you first need to check that, your YUM that is yellow update manager is updated or not. If not updated, then update it by using following command.
[root@localhost Desktop]# cd ~
[root@localhost ~]# yum update
If there is an update necessary, then it will update automatically if you have an active internet connection. And it will not update, if you have updated yum. So now lets move to the next step. Now we’ll install FTP software, which is vsftpd.
[root@localhost ~]# yum check-update
[root@localhost ~]#yum -y install vsftpd
Now after installing vsftpd, we’ll take a back up copy of this software.
[root@localhost ~]# cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.org
After that we’ll open this software using “nano editor command”
[root@localhost ~]#nano /etc/vsftpd/vsftpd.conf
We’ve opened the configuration file of that vsftpd.
Now make changes as following:
Now find this line anonymous_enable=YES ( Line no : 12 ) and change the value to NO to disable anonymous FTP access.
anonymous_enable=NO
Uncomment the below line ( Line no : 100 ) to restrict users to their home directory.
chroot_local_user=YES
and add the below lines at the end of the file to enable passive mode and allow chroot
writable.
allow_writeable_chroot=YES
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=40100
Now we need to restart the vsftpd service and enable the service. So lets do this using command promote, that is command terminal.
[root@localhost ~]#systemctl restart vsftpd.service
[root@localhost ~]#systemctl enable vsftpd.service
Now we need to make some change to the firewall to allow access of the FTP service we have created and after that we need to reload or restart the firewall service.
[root@localhost ~]# firewall-cmd –permanent –add-service=ftp
[root@localhost ~]# firewall-cmd –reload
Now we need to make some changes to SElinux to allow the service of this FTP server also.
[root@localhost ~]# setsebool -P ftp_home_dir on
So we’ve almost finished configuring the FTP server, now you can create user for the FTP server. Please note that /sbin/nologin directory is created for disallow shell access to the server. So lets create user:
[root@localhost ~]# useradd -m jim -s /sbin/nologin
[root@localhost ~]# passwd jim
Now we’ve successfully created a user and now using this user we can now be able to log in using port no 21. We can take help different types of FTP client like filezilla to access the server using this user.
So hope that you’ve enjoyed setup ftp server linux. If you have any kinds od question related this post, feel free to comment and we’ll be very glad to help you.
Leave a Reply