2.2.6.2. Anonymous Access
				The presence of the 
/var/ftp/ directory activates the anonymous account.
			
				The easiest way to create this directory is to install the 
vsftpd package. This package establishes a directory tree for anonymous users and configures the permissions on directories to read-only for anonymous users.
			
				By default the anonymous user cannot write to any directories.
			
Warning
					If enabling anonymous access to an FTP server, be aware of where sensitive data is stored.
				
Procedure 2.1. Anonymous Upload
- To allow anonymous users to upload files, it is recommended to create a write-only directory within the/var/ftp/pub/directory. Run the following command as root to create such directory named/upload/:mkdir /var/ftp/pub/upload ~]# mkdir /var/ftp/pub/uploadCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Next, change the permissions so that anonymous users cannot view the contents of the directory:chmod 730 /var/ftp/pub/upload ~]# chmod 730 /var/ftp/pub/uploadCopy to Clipboard Copied! Toggle word wrap Toggle overflow A long format listing of the directory should look like this:ls -ld /var/ftp/pub/upload ~]# ls -ld /var/ftp/pub/upload drwx-wx---. 2 root ftp 4096 Nov 14 22:57 /var/ftp/pub/uploadCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note Administrators who allow anonymous users to read and write in directories often find that their servers become a repository of stolen software.
- Undervsftpd, add the following line to the/etc/vsftpd/vsftpd.conffile:anon_upload_enable=YES anon_upload_enable=YESCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- In Red Hat Enterprise Linux, the SELinux is running in Enforcing mode by default. Therefore, theallow_ftpd_anon_writeBoolean must be enabled in order to allowvsftpdto upload files:setsebool -P allow_ftpd_anon_write=1 ~]# setsebool -P allow_ftpd_anon_write=1Copy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Label the/upload/directory and its files with thepublic_content_rw_tSELinux context:semanage fcontext -a -t public_content_rw_t '/var/ftp/pub/upload(/.*)' ~]# semanage fcontext -a -t public_content_rw_t '/var/ftp/pub/upload(/.*)'Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note Thesemanageutility is provided by the policycoreutils-python package, which is not installed by default. To install it, use the following command as root:yum install policycoreutils-python ~]# yum install policycoreutils-pythonCopy to Clipboard Copied! Toggle word wrap Toggle overflow 
- Use therestoreconutility to change the type of/upload/and its files:restorecon -R -v /var/ftp/pub/upload ~]# restorecon -R -v /var/ftp/pub/uploadCopy to Clipboard Copied! Toggle word wrap Toggle overflow The directory is now properly labeled withpublic_content_rw_tso that SELinux in Enforcing mode allows anonymous users to upload files to it:ls -dZ /var/ftp/pub/upload ~]$ ls -dZ /var/ftp/pub/upload drwx-wx---. root root unconfined_u:object_r:public_content_t:s0 /var/ftp/pub/upload/Copy to Clipboard Copied! Toggle word wrap Toggle overflow For further information about using SELinux, see the Security-Enhanced Linux User Guide and Managing Confined Services guides.