TransWikia.com

How to fix vsftpd error: 500 OOPS: cannot change directory

Server Fault Asked by i3i5i7 on January 1, 2022

I am trying to setup vsftpd for anonymous-only, read-only access on my Ubuntu 20.04 VM. Home directory is /home/ftp/filebase. When I try to login, I get the error

500 OOPS: cannot change directory: "/home/ftp/filebase"

and am kicked out.

There are a few questions on this here already. Most suggest to disable SELinux (not installed here) or to adjust directory permissions to give access up to the top:

# ls -al
total 2097232
drwxr-xr-x   4 root root       4096 Jul 24 18:32 home
/home# ls -al
drwxr-xr-x  3 ftp   ftp   4096 Jul 24 18:34 ftp
/home/ftp# ls -al
drwxr-xr-x   3 ftp  ftp  4096 Jul 24 18:34 .
drwxr-xr-x   4 root root 4096 Jul 24 18:32 ..
drwxrwxr-x 198 ftp  ftp   212 Mai 17  2018 filebase

So all directories up the line have read and execute permissions for everyone.

my config:

listen=YES
listen_ipv6=NO
anonymous_enable=YES
local_enable=NO
anon_root="/home/ftp/filebase/"
no_anon_password=YES
hide_ids=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=NO
pasv_enable=Yes
pasv_min_port=40110
pasv_max_port=40210
ls_recurse_enable=YES
secure_chroot_dir=/var/run/vsftpd/empty

The logfile is pretty silent:

Fri Jul 24 19:16:59 2020 [pid 7822] CONNECT: Client "192.168.1.2"
Fri Jul 24 19:16:59 2020 [pid 7818] [ftp] OK LOGIN: Client "192.168.1.2", anon password "<no_password>"

Please, what am I missing?

One Answer

Ok, that's stupid.

anon_root=/home/ftp/filebase/

Without quotes, it is working. And while it's important that execute and read permissions exist to the root, there may not be write permissions. Otherwise, vsftpd throws the error

500 OOPS: vsftpd refusing to run with writable root inside chroot()

Answered by i3i5i7 on January 1, 2022

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP