Build an FTP server with vsftpd on CentOS / RHEL / Fedora
At this time we will implement one of the features of a Linux server, the FTP server. FTP servers, as we know, are one of the services on Linux that are more specifically for data exchange. In this article, we are building an FTP server with vsftpd on CentOS / RHEL / Fedora, where we will try to install and configure an FTP server with vSFTPD as its daemon, along with the steps:
Install vsftpd
Install vsftpd
1 | # yum install vsftpd |
After the installation process is complete, run vsftpd and check the status with netstat
1 2 | # service vsftpd start # netstat -a | grep ftp |
make sure that the vsftpd process is running, as follows:
1 2 | [root@backlinux ~]# netstat -a | grep ftp tcp 0 0 *:ftp *:* LISTEN |
in the step below, we will configure vsftpd.conf which is in /etc/vsftpd/vsftpd.conf:
The Anonymous / guest user home folder is in / data / ftp / guest user;
1 2 | # mkdir -p /data/ftp/guest-user # vi /etc/vsftpd/vsftpd.conf |
add the following code (default /var/ftp);
1 | anon_root=/data/ftp/guest-user |
Create an upload location folder for anonymous / guest users:
1 2 | # mkdir -p /data/ftp/guest-user/uploads # chmod 722 /data/ftp/guest-user/uploads |
Modified vsftpd welcome banner
1 | # vi /etc/vsftpd/vsftpd.conf |
edit / add the following code;
1 | ftpd_banner= Masukkan welcome banner FTP server disini | BackLinux.com |
Make FTP user with “Read / read” access rights on FTP share directory
Edit the file /etc/vsftpd/vsftpd.conf
1 | # vi /etc/vsftpd/vsftpd.conf |
Update or adjust with the following code:
1 2 | anonymous_enable=NO local_enable=YES |
Restart service vsftpd server
1 | # service vsftpd restart |
Create a ftp-users group and the ftp-documents home folder that will be used as an information / FTP location of each user.
1 2 3 4 | # groupadd ftp-users # mkdir /home/ftp-documents # chmod 750 /home/ftp-documents # chown root:ftp-users /home/ftp-documents |
Add a user to register into the respective group and home folder.
1 2 3 4 | # useradd -g ftp-users -d /home/ftp-documents user1 # useradd -g ftp-users -d /home/ftp-documents user2 # useradd -g ftp-users -d /home/ftp-documents user3 # useradd -g ftp-users -d /home/ftp-documents user4 |
1 2 3 4 | # passwd user1 # passwd user2 # passwd user3 # passwd user4 |
1 2 | # chown root:ftp-users /home/ftp-documents/* # chmod 740 /home/ftp-documents/* |
I hope it has been a useful article.