The ubuntu system uses vsftpd to build an FTP server.

To use vsftpd to build an FTP server on the Ubuntu system, you can follow the steps below:

  1. Install vsftpd:
    Open a terminal and execute the following command to install vsftpd:

    sudo apt update
    sudo apt install vsftpd
  2. Configure vsftpd:
    Use a text editor (such as nano or vi) to open the configuration file of vsftpd:

    sudo nano /etc/vsftpd.conf

    In the configuration file, you can make the following changes or additions as needed:

    • Enable anonymous access (if required):

      anonymous_enable=YES
    • Disable anonymous uploads (if desired):

      anon_upload_enable=NO
    • Enable local user access:

      local_enable=YES
    • Set the list of users allowed to log in:

      userlist_enable=YES
      userlist_file=/etc/vsftpd.userlist
      userlist_deny=NO
    • If you want to restrict users to only their home directory, uncomment the following line:

      chroot_local_user=YES
      chroot_list_enable=YES
      chroot_list_file=/etc/vsftpd.chroot_list
    • Save and close the file.
  3. Create user:
    If you want to allow local users to access the FTP server, you can create FTP users. Execute the following command to create a new user:

    sudo adduser ftpuser

    Set the user name and password according to the prompts.

  4. Start the vsftpd service:
    Execute the following command to start the vsftpd service:

    sudo systemctl start vsftpd
  5. Configure firewall:
    If your system has enabled a firewall (such as ufw), you need to open the FTP data port. Execute the following command to allow FTP transfers:

    sudo ufw allow 20/tcp
    sudo ufw allow 21/tcp
  6. Authenticating the FTP server:
    Use an FTP client on another computer to connect to your FTP server and log in with the created user credentials. You should be able to successfully connect to the FTP server and access files.

Now you have successfully built an FTP server using vsftpd on the Ubuntu system. Please note that these steps are for Ubuntu systems, if you are using other Linux distributions, please consult the corresponding documentation or guide for operation.

Guess you like

Origin blog.csdn.net/tiansyun/article/details/131266544