2

I'm trying to configure my web server from scratch and since this is my first time doing everything on my own, I'm unsure what kind of permissions I need to set for each site I have in /var/www.

As of right now, I have the following layout for 2 of my websites that I host:

/var/www/ |-- blog.dev/
      |--  public_html/
              |-- .htaccess
              |-- wp-admin
              |-- wp-content
              ... 
|-- web.dev/
      |--  public_html/
              |-- .htaccess
              |-- index.php

As it is right now, my current workflow is mostly consisted of me ssh-ing into the server and occasionally uploading files via sftp. So, I need my user account to be able to modify everything alongside with apache being able to modify stuff as well when I, for instance, upload a picture via Wordpress blog.

So, I have assigned chmod 775 to both public_html's and placed them in chown www-data:www-data, but am unsure if this is safe. /var/www is still owned by root, my user account is also placed in www-data group. My question is, what could I do to improve the overall setup. This feels extremely awkward and clumsy; It just doesn't feel right the way I did it. What are some more fool proof ways to properly configure the permissions so that I can shield myself from potential compromise.

1
  • I think the directory structure has some formatting problems: are blog.dev and web.dev subdirectories of /var/www, on the same level as the first plublic_html? Or maybe the first public_html is a subfolder of blog.dev? Please edit your question.
    – Arjan
    Oct 14, 2015 at 8:04

0

You must log in to answer this question.

Browse other questions tagged .