0

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
  • which php handler enabled in apache?
    – ADM
    Oct 3, 2015 at 19:21

1 Answer 1

0

I think it would be a good idea to lock down the permissions for your web apps. Unless required, write access should be restricted. Change files and directories to read-only and change their ownership to someone else, maybe root. If they are read only and belong to www-data, their permissions can still be changed.

Not the answer you're looking for? Browse other questions tagged .