LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 02-07-2017, 08:50 PM   #1
drillsar
Member
 
Registered: Jan 2017
Posts: 144

Rep: Reputation: Disabled
Apache Permission problem help


I installed Apache now I have an issue with permissions.

I added my user to apache group by doing this

usermod -aG apache user

I Chown -R user:user /var/www/website

When I go to website says can't display the page. However, when I chown -R apache:apache /var/www/website it works, but user don't have permission to edit files, etc.

I am confused.
 
Old 02-09-2017, 06:08 AM   #2
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,333
Blog Entries: 3

Rep: Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730Reputation: 3730
The apache user should not have anything to do with the directories containing the directories, except in a few really fringe use cases. It exists to provide privilege separation, that is it should lack permissions to write so that the web server cannot write to pages it is serving. It only needs read access, and that is most easily supplied through Other, leaving Group alone. If you are the only user on the system, then you can just take ownership yourself:

Code:
chown -R drillsar:drillsar /var/www/website/
find /var/www/website/ -type d -exec chmod u=rwx,g=rx,o=rx {} \;
find /var/www/website/ -type f -exec chmod u=rw,g=r,o=r {} \;
If you want a longer discussion on various advanced options for sharing write access within a group of accounts, see Sharing Write Access to a Web Directory for Multiple Users
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Apache server: permission and symbolic link problem zunnoorainfarooqui Linux - Server 14 06-02-2014 09:16 AM
permission problem when run php script by apache Barq Linux - Server 9 05-11-2009 03:03 AM
very strange apache permission problem txm123 Linux - Newbie 2 08-03-2007 08:48 PM
Apache File Permission Strange Problem hcubed Linux - Networking 1 05-15-2004 01:09 AM
apache permission problem Haakon Linux - Newbie 5 12-10-2001 11:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 02:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration