Page 1 of 1

Can't access website when files owned by user

Posted: 2018/03/07 21:08:54
by doulos
I do not understand. I have given the user ownership of everything with

Code: Select all

sudo chown -R myuser:myuser
Given the user access to apache group with

Code: Select all

usermod -a -G apache myuser
But, when I try to connect to the site i get
Forbidden
You don't have permission to access / on this server.
Site works fine if I assign the files to apache. What am I missing?

Re: Can't access website when files owned by user

Posted: 2018/03/08 05:29:07
by hunter86_bg
Well, how is the apache going to read your files after the startup procedure?
Leave the apache:apache and set 'facl' recursively for your dev account, or use '.htaccess'.

Re: Can't access website when files owned by user

Posted: 2018/03/08 09:32:42
by TrevorH
Also, if you amend the permissions of directories that are owned by rpm packages - like /var/www/html is owned by the httpd rpm - then the permissions will get reset to the defaults on every package update.

Re: Can't access website when files owned by user

Posted: 2018/03/08 20:25:22
by doulos
I also gave apache access to all the files and directories owned by myuser.

I must be missing something since I have this working fine my other web server running the same OS, and on another running Ubuntu.

Re: Can't access website when files owned by user

Posted: 2018/03/09 10:33:39
by markkuk
doulos wrote:I also gave apache access to all the files and directories owned by myuser.
The command "usermod -a -G apache myuser" in your original post gives you (myuser) rights to files owned by the group apache. You should have done the following to achieve what you stated:

Code: Select all

usermod -a -G myuser apache

Re: Can't access website when files owned by user

Posted: 2018/03/09 11:21:51
by doulos
markkuk wrote:
doulos wrote:I also gave apache access to all the files and directories owned by myuser.
The command "usermod -a -G apache myuser" in your original post gives you (myuser) rights to files owned by the group apache. You should have done the following to achieve what you stated:

Code: Select all

usermod -a -G myuser apache
Yes. Sorry, though I failed to put that in the post, I did in fact run that command also - and then verified that apache is in the myuser group, and myuser is in the apache group