Can't access website when files owned by user

General support questions
Post Reply
doulos
Posts: 36
Joined: 2015/11/07 17:55:32

Can't access website when files owned by user

Post by doulos » 2018/03/07 21:08:54

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?

hunter86_bg
Posts: 1448
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

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

Post by hunter86_bg » 2018/03/08 05:29:07

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'.

User avatar
TrevorH
Forum Moderator
Posts: 24078
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

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

Post by TrevorH » 2018/03/08 09:32:42

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.
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

doulos
Posts: 36
Joined: 2015/11/07 17:55:32

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

Post by doulos » 2018/03/08 20:25:22

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.

markkuk
Posts: 739
Joined: 2007/09/07 10:56:28
Location: Finland

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

Post by markkuk » 2018/03/09 10:33:39

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

doulos
Posts: 36
Joined: 2015/11/07 17:55:32

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

Post by doulos » 2018/03/09 11:21:51

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

Post Reply