Screwed up all ownerships and permissions

BlueCola

Verified User
Joined
Jan 12, 2012
Messages
72
This morning, I saw there was still something wrong with the ownership en directory/file permissions. After some search at the web, I saw the following tutorial here on DA forum, for suPHP (which I run now for almost 4 days), and executed this command:

Code:
ls -l /home | grep '^d' | awk '{system("chown -R " $3 ":" $4 " /home/" $9 "/domains")}'

Which gave me the following output:

Code:
chown: cannot access `/home/ftp/domains': No such file or directory
chown: cannot access `/home/tmp/domains': No such file or directory

After this, not a single website or mail was working anymore. I tried several things, like:

Code:
Chown -R $user:$user /home/$user

But it didn't worked. Also I ran './set_permissions all', which didn't worked either. When I go to a website that's hosted on my server, I get a 403 error, with in the logs the following error message:

Code:
[Tue Jan 24 00:32:16 2012] [crit] [client 86.93.46.73] (13)Permission denied: /home/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

What should I do now? I totally screwed up.
 
Notice, that the 403 error is triggered by the wrong path to the .htaccess file.
 
With suPHP the files must be owned by the user.. the file in the error is in /home... should be suppose to be in /home/user (or /home/user/domain/domain/public_html) and owned with user:group same as username of the domain owner.

Regards
 
http://help.directadmin.com/item.php?id=363

Its definitely ownership related.

Ill list you some of my ownerships:

/home root/root - 0711
/home/randomuser access / randomuser - 0710 (access instead of randomuser since I'm using secure access group http://www.directadmin.com/features.php?id=961)

Check what group/user owners and write access has been configured for these paths so you know whats wrong exactly.
Like SeLLeRoNe said, I'm using suPHP. So the files has to be owned by user:access. Also, I don't understand why it's looking for .htaccess in the /home/ folder, because there should never be a htaccess file there.

With suPHP the files must be owned by the user.. the file in the error is in /home... should be suppose to be in /home/user (or /home/user/domain/domain/public_html) and owned with user:group same as username of the domain owner.

Regards

Do you know how to fix it?
 
Thats in fact the strange part of your issue, for every user and every domain is giving that error trying to point to /home/.htaccess?
 
Some more info, when I do 'ls -l', this is what I get(only took 2 users out of the list, but it seems that the ownerships are fine):

Code:
drwx--x--- 5 username1      access    4096 Jan 19 22:36 username1
drwx--x--- 6 username2     access    4096 Jan 19 22:50 username2
 
Code:
./build update
./build all d
./build rewrite_confs

That's what I should run now?
 
Thats in fact the strange part of your issue, for every user and every domain is giving that error trying to point to /home/.htaccess?

That's OK, while Apache scans all higher-level directories.

Further note that Apache must look for .htaccess files in all higher-level directories, in order to have a full complement of directives that it must apply. (See section on how directives are applied.) Thus, if a file is requested out of a directory /www/htdocs/example, Apache must look for the following files:

Code:
 /.htaccess
 /www/.htaccess
 /www/htdocs/.htaccess
 /www/htdocs/example/.htaccess

And so, for each file access out of that directory, there are 4 additional file-system accesses, even if none of those files are present. (Note that this would only be the case if .htaccess files were enabled for /, which is not usually the case.)

http://httpd.apache.org/docs/2.2/howto/htaccess.html#when

So the error

Permission denied: /home/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

is caused by bad permissions.
 
Back
Top