How to Install and Use vsFTPd on a CentOS Cloud Server?

05-02-2024 02:13:40

FTP is a widely used protocol for transferring files over the network. This guide is based on a CentOS 7 cloud server and describes the method for installing and using the vsFTPd software.

First, remotely log into the cloud server and update the operating system to the latest state.

yum upgrade -y

After the update is completed, install the vsFTPd software.

yum install -y vsftpd

Before it is officially used, some adjustments need to be made to the vsFTPd configuration file.

vi /etc/vsftpd/vsftpd.conf

Disable anonymous access.

anonymous_enable=NO

Allow file uploads.

write_enable=YES

Restrict users to upload files only to their own directory.

chroot_local_user=YES
chroot_list_enable=NO
allow_writeable_chroot=YES

Set the minimum and maximum ports for passive mode.

pasv_min_port=8000
pasv_max_port=9000

After saving and exiting, restart vsFTPd to apply the changes.

systemctl restart vsftpd

If the CentOS 7 firewall, firewalld, is enabled, it is necessary to open the corresponding ports for the FTP service on the firewall.

firewall-cmd --permanent --add-port=20-21/tcp
firewall-cmd --permanent --add-port=8000-9000/tcp
firewall-cmd --reload

Finally, use an FTP client to upload files to the cloud server. After a successful upload, the uploaded files can be seen in the /home/ directory.