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

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, July 22, 2016

Follow me on Twitter as @mattiasgeniar

The following error can occur when you just installed vsftpd on a Linux server and trying to FTP to it.

Command:	USER xxx
Response: 	331 Please specify the password.
Command:	PASS ******************
Response: 	500 OOPS: vsftpd: refusing to run with writable root inside chroot()
Error:        	Critical error: Could not connect to server

This is caused by the fact that the directory of the user you’re connecting to, is write-enabled. In normal chroot() situations, the parent directory needs to be read-only.

This means for most situations of useradd, which will create a home directory owned and writeable by the user, the above error of “vsftpd: refusing to run with writable root inside chroot()” will be shown.

To fix this, modify the configuration as such.

$ cat /etc/vsftpd/vsftpd.conf
...
allow_writeable_chroot=YES

If that parameter is missing, just add it to the bottom of the config. Next, restart vsftpd.

$ service vsftpd restart

After that, FTP should run smoothly again.

Alternatively: please consider using sFTP (FTP over SSH) or FTPs (FTP via TLS) with a modified, non-writeable, chroot.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.