I have been having issues with Backupbuddy saying that it does not have the proper permissions to create directories and files.
I have looked everywhere for the proper file permissions for WP (I have an ubuntu +nginx + WP droplet) but cannot seem to find the proper permissions.
The last time I changed permissions, all I got going to the site was a white screen. No errors - just a white screen. Had to restore from backup.
Guessing at this seems to be quite dangerous. How do I set the proper file and directory permissions for WP that allows wp-config.php to be written during the 5 minute install (without me having to cut the wp-config code out, log into the server via FTP, create wp-config.php, paste in the code and save the file), and allows plugins like Backupbuddy to have the permissions they need in the uploads directory?
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!
This is one of those times when I am forced to ask just why people use Linux. Even the simple stuff isn’t.
I hear your frustration. It took me a while to wrap my head around permissions.
In this case, here is what happens:
your user creates files as youruser:youruser rather than youruser:www-data
there is actually a good reason for that, which is that you do not want your web-server (www-data) to have access to your user files. If that happened, and your website was hacked, then the hacker could have access to your user account, and from there gain access to your computer.
The problem pops up when you want to create new files for your website, and then end up with www-data not having access.
There are different solutions, but the one I have found that works for me is listed in my answer above:
http://blog.netgusto.com/solving-web-file-permissions-problem-once-and-for-all/
I use that technique to create a folder in called www in my users folder, then mount my web directory in that folder using that method…
The result is I can create files in the www folder. I see them as having permissions for me, but in the actual web folder the permissions show up as www-data:www-data
I can do that for as many users as I need, and each user can create files that all end up being owned by www-data:www-data
It’s not really dangerous, as you can correct things fairly easily from the command line.
Short answer: when you are installing Wordpress, you are probably logged in as a certain user. We will say “robin”
you upload all those Wordpress files, and so robin is the owner of everything. Well, your webserver is most likely running as a user called www-data, and needs ownership to be able to read/write things properly.
so after you finish uploading everything (and before running the install), you should give ownership to www-data. You can do this from a command-line like so:
sudo chown -R www-data:www-data /var/www
which says: give www-data ownership of all files in /var/www
Now Wordpress should be able to run fine…but what if you want to edit some files? Gosh! You are not the owner.
The answer is that you can add yourself as to the www-data group, like so:
sudo usermod -aG www-data robin
which says "make robin a member of www-data group. Great! but one more step: you need to make sure those files can be edited by group-members:
sudo chmod -R 774 /var/www
Okay. You should be good to go, unless later on you create new files, and then you need to run (again)
sudo chown -R 774 /var/www
There is a way that you can avoid all of this completely, (and I have recently adopted this method with great results:
http://blog.netgusto.com/solving-web-file-permissions-problem-once-and-for-all/
By using this method, I have a folder in my users home directory called www Anything I add to that directory automatically has the correct permissions for everyone I want to have access! Might be advanced, but is a worth having a look.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.