LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-23-2016, 04:34 PM   #1
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Rep: Reputation: 40
apache requires owner root to access /var/www/html


Hi group,
My Apache set up on my laptop is getting really annoying. I use it to develop my web pages, so I need to be able to edit them, which requires RW privileges for me but when I save it and try to access them, I get
Code:
 
Forbidden

You don't have permission to access /index.html on this server.
unless I change ownership to root. I have Apache User defined as me in httpd.conf and httpd runs as me.

This is getting very frustrating.

Can anyone provide me with a work around?
 
Old 10-23-2016, 04:42 PM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
ls -l will tell you who owns the file, add your user to relevant group.
 
Old 10-23-2016, 05:35 PM   #3
MrUmunhum
Member
 
Registered: May 2006
Location: Mt Umunhum, CA, USA, Earth
Distribution: Debian/ Fedora/ Ubuntu/ Raspbian
Posts: 549

Original Poster
Rep: Reputation: 40
fix problem with:
Code:
<Directory "/home/me/HTML">
    Order allow,deny
    Allow from all
  </Directory>
 
Old 10-24-2016, 12:25 AM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,288
Blog Entries: 3

Rep: Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718Reputation: 3718
Quote:
Originally Posted by MrUmunhum View Post
I have Apache User defined as me in httpd.conf and httpd runs as me.

This is getting very frustrating.
The simple way of dealing with write privileges on a one-user system is that you can just take ownership of the files with "chown". Then you can write. No need to change the httpd user in the configuration. In fact that can be a bad idea.

The group membership suggestion is sound if the Apache server cannot both serve a page and write to it. If you are in a group which can write to the directories and the web server is running as you, then the server can write to the files. That violates the idea of privilege separation. Each part should only have the privileges necessary to fulfill its tasks. Ideally, the web server runs as a unique user which can only read the files. That way if someone does find a way in via it, they can't start writing their own web pages or, worse, scripts.

My recommendation would be to set the user in the web server's configuration file back to what it was supposed to be, in regards to httpd user. What problem are you trying to solve by changing it? The other change, that of Directory settings is fine.

Last edited by Turbocapitalist; 10-24-2016 at 12:27 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the best way of enabling non-root access to /var/www/html? AdultFoundry Linux - Newbie 8 11-02-2015 04:14 PM
Nginx + Apache. Always get /var/www/html/index.html angryrabbit Linux - Server 1 11-27-2011 04:56 PM
ftp access to /var/www/html bmccarty12 Linux - General 2 10-16-2009 12:21 PM
FTP client can't access files in /var/www/html (Apache ) dshap Linux - Newbie 8 06-03-2009 12:12 PM
should var/www/html be accessible to root only? linuxfond Linux - Newbie 1 09-06-2003 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:59 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