Linux系统搭建FTP服务器步骤

Sure, here are the steps to set up an FTP server on Linux:

  1. Install vsftpd (Very Secure FTP Daemon):

    sudo apt-get update
    sudo apt-get install vsftpd
    
  2. Configure vsftpd: Edit the configuration file /etc/vsftpd.conf using a text editor like nano or vim.

    sudo nano /etc/vsftpd.conf
    

    Modify the following configurations:

    • Uncomment or add write_enable=YES to allow write access.
    • Uncomment or add local_umask=022 to set file permissions.
    • Optionally, you can restrict users to their home directories by uncommenting chroot_local_user=YES.
  3. Restart vsftpd: After making changes, restart the vsftpd service for the changes to take effect.

    sudo systemctl restart vsftpd
    
  4. Open Firewall Ports: If you have a firewall enabled, allow connections on port 21, which is the default port for FTP.

    sudo ufw allow 21/tcp
    
  5. Create FTP Users: You can create FTP users with their respective home directories.

    sudo adduser ftpuser
    
  6. Set Permissions: Ensure that the permissions of the user's home directory and its contents are set appropriately.

    sudo chmod 755 /home/ftpuser
    
  7. Test the FTP Server: You can now test the FTP server by connecting to it using an FTP client like FileZilla or the ftp command-line tool.

    ftp your_server_ip
    

That's it! Your FTP server should now be set up and running on your Linux system.