Fixing permission errors with vsftpd on Ubuntu

September 25, 2014 8.1k views


I've followed the steps to setup vsftpd on my Ubuntu 12.04 VPS and I can connect to the server with my specially-created FTP user. My issue is that I want that user to have access to /var/www/ (where I keep all my nginx sites). I can browse to that directory but can't modify anything there – I see things like "550 Delete operation failed" when I try.

I think I could fix this by chown'ing the www directory for my FTP user, but is this a bad idea? I don't know what permissions nginx expects on that folder – would this break things? Is there a better solution? I just want to be able to upload large files (MP3s etc) via FTP which can then be served on the web.


1 Answer

nginx needs read access only, so you can safely chown the directory to your FTP user. However, that won't be as secure because your password is sent as plaintext over the internet when you use FTP -- consider using SFTP instead :).

sudo chown -R youruser:youruser /var/www

If you're running a web application that needs write access to a specific directory, you will need to change the said directory's group ownership to www-data and set group write permissions:

sudo chgrp -R www-data /var/www/directory
sudo chmod -R g+w /var/www/directory
by Pablo Carranza
This article will teach you how to use Filezilla to transfer and manage files securely on your VPS.
  • Thank you, this worked, kind of.

    The files I uploaded transferred properly but when I tried to access them in the browser I got a 403 error. My SSH user couldn't cd into those directories so I had to chmod them to 755 (using sudo) which meant I could serve them as webpages. Is that a vsftpd config issue or something relating to permissions still?

    Apologies if this is a fairly obvious issue; I'm pretty new to the concept of user/group permissions on Linux.

Have another answer? Share your knowledge.