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

Written by
Date: 2012-05-04 21:39:00 00:00

I've installed vsftp FTP server in Arch Linux, and trying to run it with pam virtual users in a chroot'ed environment I've got this error:

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

This problem is caused because the users should not be able to write in the root directory they are chrooted to. One way to solve it, is to declare the root folder one level above the user folder.

Let's say /srv/ftp/ instead of /srv/ftp/user1/

So, define:

local_root=/srv/ftp/

Instead of:

local_root=/srv/ftp/$USER/

The usual work around of doing this: chmod a-w /home/user will cause more problems than any good, as the user will lose his rights on his own home folder.