Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Serg0/cdc0d89d4dd17275ae59d29882ae6f22 to your computer and use it in GitHub Desktop.
Save Serg0/cdc0d89d4dd17275ae59d29882ae6f22 to your computer and use it in GitHub Desktop.
[vsftpd]Setup anonymous upload and download FTP server

Install vsftpd

# Install
sudo apt update
sudo apt install vsftpd
sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.orig

# Firwall rules
sudo ufw allow ftp-data
sudo ufw allow ftp
sudo ufw status

# Preparing Space for Files
sudo mkdir -p mapftp
sudo chown nobody:nogroup mapftp
echo "vsftpd test file" | sudo tee mapftp/test.log
sudo mkdir mapftp/maps/
sudo chmod a+rwx mapftp/maps/

Configure Anonymous Access

  • Edit /etc/vsftpd.conf
  • Change the following:
  1. anonymous_enable=YES to allow anonymous access
  2. write_enable=YES to enable uploading
  3. anon_upload_enable=YES to enable anonymous uploading
  4. anon_mkdir_write_enable=YES to enable anonymous directory creation
  • Append the following to the end: 1.anon_umask=022 so that new file will be readable by groups and other users. Uploaded files will have a permittion set to the value of file_open_mode (by default, 0666) subtracted by anon_umask.
  1. anon_other_write_enable=YES to enable anonymous deletion and renaming
  2. anon_root=xxx/mapftp sets the root folder for anonymous logins
  3. no_anon_password=YES stops prompting for a password on the command line.
  4. hide_ids=YES shows the user and group as ftp:ftp, regardless of the owner.
  5. pasv_min_port=40000 and pasv_max_port=50000 limits the range of ports that can be used for passive FTP
  • Optionally changes the listening port:
  1. listen_port= followed by port number

Conclusion

On Linux, use the ftp command to access the server, e.g. ftp -p 192.168.0.2 then followed by anonymous as the username. On Windows, use Windows Explorer or other FTP tools.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment