Fixing permission errors with vsftpd on Ubuntu


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.

thanks! matt

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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

Holy moly… This is what I needed.