I am using ubuntu 18.04. I need to set up vsftpd in so that anonymous uploads and downloads are possible (i.e logging in by typing "anonymous" as username and anything as password). I also need the anonymous root to be a specific directory. I know it's not secure, but security doesn't matter in this case. My vsftpd.conf file:
listen=YES
local_enable=YES
write_enable=YES
xferlog_file=YES
anonymous_enable=YES
anon_root=/var/www/html/Ax78klm34e4ijKSi8lnik
anon_upload_enable=YES
anon_mkdir_write_enable=YES
chown_uploads=YES
chown_username=ftp
allow_writeable_chroot=YES
These are the permissions for that directory
drwxrwxrwx 5 root root 4096 Jun 6 11:01 ./
drwxr-xr-x 3 root root 4096 Jun 4 10:07 ../
drwxrwxr-x 7 root root 4096 May 27 19:34 assets/
drwxrwxrwx 2 root root 4096 Jun 5 22:03 Ax78klm34e4ijKSi8lnik/
-rw-r--r-- 1 root root 465 Jun 4 16:55 config.php
-rw-rw-r-- 1 root root 883 May 27 19:34 gulpfile.js
-rw-rw-r-- 1 root root 57676 Jun 5 14:32 index.php
-rw-rw-r-- 1 root root 1069 May 27 19:34 LICENSE
-rw-r--r-- 1 root root 3291 Jun 5 17:48 login.php
drwxrwxr-x 2 root root 4096 May 27 19:34 media/
-rw-rw-r-- 1 root root 1296 Jun 5 11:45 package.json
-rw-r--r-- 1 root root 5307 Jun 4 23:36 register.php
-rw-r--r-- 1 root root 31 Jun 5 14:40 robots.txt
-rw-r--r-- 1 root root 109 Jun 5 17:43 test.php
This is the error that i'm getting
Connected to 192.168.43.57.
220 (vsFTPd 3.0.3)
Name (192.168.43.57:archangel): anonymous
331 Please specify the password.
Password:
500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Login failed.
ftp>
I tried changing the permissions of the required directory to 0755, then the above issue is resolved, but i'm unable to upload in that case.