How to configure VPS so that it is not nessacery to have 777 permissions on public_html for wordpress installation?

Posted December 17, 2013 4.3k views
I am doing an installation of Wordpress on my VPS. During isntallation I had to set public_hml permissions to 777. Of course, I changed it back after installation, but how can I prevent this on the next installation? I am intending to install multiple wordpress sites soon, and want the installation to be as smooth as possible. And of course, I am just curious how this works. My folder and files all have owner of my server, and since 750 on public_html gives enough permission for a owner to install wordpress I am curious how it is possible that I have unsufficient permissions. Thanks!

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.

Submit an Answer
5 answers
I have digged in existing questions on this matter, and found this (possible) solutions:
sudo usermod -a -G apache username

Is that what I need to do, or has that nothing to do with this?
Ok, I tried doing this, but user group apache does not exist is what I get..
Apologies for all these comments, but I found out that on Ubuntu it has to be www-data instead of apache. I have run that command, and restarted apache, but still my I have not sufficient rights to do almost anything. For example, I cannot install plugins and upload files unless I set permissions to 777
Check out this article-- it may address your issue:
by Justin Ellingwood
WordPress is the most popular content management system (CMS) on the web currently. While WordPress can be a great way to manage you content, there are some very insecure configurations that are given throughout the internet. This article will cover how to set up secure updates and installations using SSH keys instead of FTP, which is an inherently insecure protocol.
Hi, Thanks! Very usefull article, added to favorites.

For now, I fixed it by setting owner of all wordpress files to www-data.