A Beginner's Guide to Setting up vsftpd Server on CentOS 7

A Beginners Guide to Setting up vsftpd Server on CentOS 7

Are you looking for an easy way to share files between multiple computers on your network? FTP (File Transfer Protocol) can be a great solution, and vsftpd (Very Secure FTP daemon) is one of the most popular FTP servers out there. In this guide, we will show you how to set up vsftpd server on CentOS 7.

Requirements:

  • A CentOS 7 server with root access
  • Basic knowledge of Linux command line

Step 1: Install vsftpd

First, you need to install vsftpd on your CentOS 7 server. Open up the terminal and run the following command:

sudo yum install vsftpd

Step 2: Configure vsftpd

Once you have installed vsftpd, you need to configure it. The main configuration file for vsftpd is located at /etc/vsftpd/vsftpd.conf. You can edit this file using your favorite text editor. In this guide, we will use vi:

sudo vi /etc/vsftpd/vsftpd.conf

Here are some of the most important settings you need to configure:

  • anonymous_enable: Set this to "NO" if you want to disable anonymous FTP access.
  • local_enable: Set this to "YES" if you want to allow local users to access FTP.
  • write_enable: Set this to "YES" if you want to allow users to upload files to the FTP server.
  • chroot_local_user: Set this to "YES" if you want to jail users in their home directories.
  • userlist_enable: Set this to "YES" if you want to use the userlist file.
  • userlist_file: This is the location of the userlist file. By default, it is /etc/vsftpd/user_list.
  • userlist_deny: Set this to "NO" if you want to allow users listed in the userlist file to access FTP.

After you have made the necessary changes to the vsftpd.conf file, save and exit the editor.

Step 3: Start vsftpd and Enable it on boot

Now that you have configured vsftpd, you need to start the service and enable it to start automatically on boot. Use the following commands:

sudo systemctl start vsftpd
sudo systemctl enable vsftpd

Step 4: Allow FTP traffic through firewall

By default, CentOS 7 comes with a firewall called firewalld. You need to allow FTP traffic through the firewall to access the FTP server. Use the following command:

sudo firewall-cmd --permanent --add-service=ftp
sudo firewall-cmd --reload

Step 5: Test FTP connection

Now that you have set up vsftpd, you can test it by connecting to it using an FTP client. You can use any FTP client you like, such as FileZilla, Cyberduck, or WinSCP. Simply enter the IP address or hostname of your CentOS 7 server, along with your username and password, to connect.

More Examples:

  • To create a new user for FTP access, use the following command:
sudo useradd -m -s /sbin/nologin ftpuser
sudo passwd ftpuser
  • To add the new user to the userlist file, use the following command:
sudo echo "ftpuser" | sudo tee -a /etc/vsftpd/user_list
  • To allow the new user to access FTP, edit the vsftpd.conf file and set "local_enable" and "write_enable" to "YES".

Related Searches and Questions asked:

  • Setting up FileZilla Server on Ubuntu 20.04
  • Setting up ProFTPd Server on Linux RHEL 7
  • A Beginner's Guide to Setting up Pure-FTPd Server on Ubuntu 20.04
  • Setting up FileZilla Server on Ubuntu 22.04
  • That's it for this post. Keep practicing and have fun. Leave your comments if any.

    Post a Comment

    0 Comments