- Thread Starter
- #26
Having been caught out previously by permission denied errors in the browser, I now make sure that files/directories involved are owned by www:www.Who is the owner:group of the DocumentRoot directory and all its content?
Having been caught out previously by permission denied errors in the browser, I now make sure that files/directories involved are owned by www:www.Who is the owner:group of the DocumentRoot directory and all its content?
Ehm, no. Suppose your web application gets hacked. Then they'll have access with thenow make sure that files/directories involved are owned by www:www.
www user, if this user has write access to the document root (or other directories) they'll have all the access needed to completely wreck your website, insert malware, deface it. Not my preference, but I see no problems with it as long as the permissions/ownership are all sound. It's not going to make much difference if the webserver got hacked where the exact path on the filesystem is. Lots of people seem to thinkhaving a /www directory. Thoughts on this?
www is some sort of super limited user account, it's not. It's a user account like any other. It can do anything any regular user could do on the system, including starting processes and opening listening ports (above 1024).I changed DocumentRoot and thought I had setup the correct permissions but still get permission denied and can't tell where the problem lies.Ehm, no. Suppose your web application gets hacked. Then they'll have access with thewwwuser, if this user has write access to the document root (or other directories) they'll have all the access needed to completely wreck your website, insert malware, deface it.
Leave permissions as root:wheel, and give 'other' read access (and execute on directories). That's enough for the web server to be able to serve the content. The www user rarely needs write permissions, although some web applications might have a cache or temp directory. Set write permissions on those directories and nowhere else.
Absolutely not.Could I set the root partition with www:www ownership
As a mounted file system should not be tragic, but I would not do it as a sub-directory of root.Afterwards I found other companies did such a thing--having a /www directory. Thoughts on this?
I think, that should be easy solvable with some configuration. But on the mean time I like to take things as they are,but I'd still be concerned about other apps and programs expecting it under /usr/local/www/ and I'd have to fiddle with that.
[Thu Aug 06 18:40:16.531208 2026] [autoindex:error] [pid 10242] [client 192.168.1.21:65495] AH01276: Cannot serve directory /usr/local/www/: No matching DirectoryIndex (index.php,index.html,index.html) found, and server-generated directory index forbidden by Option
s directive
DocumentRoot "/usr/local/www"
<Directory "/usr/local/www">
AllowOverride All
Require all granted
</Directory>
<VirtualHost _default_:80>
ServerName mysite.example.com
DocumentRoot "/usr/local/www/apache24/data"
<Directory "/usr/local/www/apache24/data">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
_default_ virtualhost config as 000_default.conf, so it's clear what it is and what it's for) mkdir -p /usr/local/www/mysite<html>
<head>
<title>My first website</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
Directory and DocumentRoot to /usr/local/www/mysite and reload Apache.