LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-16-2008, 03:59 PM   #1
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Rep: Reputation: 164Reputation: 164
Configure /var/www/html for user write access?


In Fedora 8, my /var/www/html directory has permissions configured as root:root. I want to be able to edit my pages as a normal user.

I suppose I could add my user to the root group, but I don't think that's the best fix in this case.

Wot doth ewe thinketh?

Also, when httpd is being started with user apache (found in httpd.conf), how does it have access to /var/www/html?

Last edited by SlowCoder; 11-16-2008 at 04:05 PM.
 
Old 11-17-2008, 12:28 AM   #2
eliufoo
Member
 
Registered: Oct 2007
Posts: 71

Rep: Reputation: 15
Hi,

Rather than changing permission on "/var/www/html", why don't you host your website inside the user home folder?
In this setup, you won't need to change permission on apache root folder.

Hope this helps...
 
Old 11-17-2008, 12:43 PM   #3
SlowCoder
Senior Member
 
Registered: Oct 2004
Location: Southeast, U.S.A.
Distribution: Debian based
Posts: 1,250

Original Poster
Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by eliufoo View Post
Hi,

Rather than changing permission on "/var/www/html", why don't you host your website inside the user home folder?
In this setup, you won't need to change permission on apache root folder.

Hope this helps...
I'm thinking all I'd need to do is change the DocumentRoot value in httpd.conf to make that happen?

But I'd still like to know how I can set it up in its current location.
 
Old 11-18-2008, 05:54 AM   #4
eliufoo
Member
 
Registered: Oct 2007
Posts: 71

Rep: Reputation: 15
Quote:
But I'd still like to know how I can set it up in its current location.
You can use one of these commands.
1)chown or chgrp --> change the ownership or group of a directory.
2)chmod --> change directory permission.

Regards,
 
Old 11-21-2008, 12:24 AM   #5
latinmusic74
Member
 
Registered: Jun 2007
Posts: 118

Rep: Reputation: 16
Maybe this can help you

1. Create a user with a home directory called /home/wwwusers

#useradd -g users wwwusers

2. Recursively chance ownership of the directory and sub directories

#chown -R wwwusers:users /home/wwwusers

3.Change permission on the /home/wwwusers directory to 755, so you can allow all users and httpd daemon to read files

#chmode 775 /home/wwwusers

4. Change SElinux security label

#chcon -R -h -t httpd_sys_content_t /home/wwwusers

5. Modify Documentroot in httpd.conf

DocumentRoot /home/wwwusers

Last edited by latinmusic74; 11-21-2008 at 12:44 AM.
 
Old 02-01-2009, 10:26 PM   #6
hablutzel1
LQ Newbie
 
Registered: Jan 2009
Posts: 3

Rep: Reputation: 0
Quote:
Maybe this can help you

1. Create a user with a home directory called /home/wwwusers

#useradd -g users wwwusers

2. Recursively chance ownership of the directory and sub directories

#chown -R wwwusers:users /home/wwwusers

3.Change permission on the /home/wwwusers directory to 755, so you can allow all users and httpd daemon to read files

#chmode 775 /home/wwwusers

4. Change SElinux security label

#chcon -R -h -t httpd_sys_content_t /home/wwwusers

5. Modify Documentroot in httpd.conf

DocumentRoot /home/wwwusers
Really useful but i've simply change the ownership of /var/www/html

as root
#chown yourusername /var/www/html

Now you can do whatever you want inside of it.
 
Old 07-24-2009, 12:26 PM   #7
shaunak
LQ Newbie
 
Registered: Jul 2009
Location: Mumbai, India
Distribution: Fedora
Posts: 8

Rep: Reputation: 0
Is there any security risk involved in changing the ownership of the /var/www/html directory?

Last edited by shaunak; 07-24-2009 at 12:33 PM.
 
Old 07-24-2009, 05:09 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by shaunak View Post
Is there any security risk involved in changing the ownership of the /var/www/html directory?
Overly broad DAC rights or changing ownership are commonly advertised as a "fix" but something like hablutzel1's example just shouldn't be used. Instead eliufoo's idea of using Apache's UserDir directive makes sense. If that doesn't work for you then you might want to look at ACL's (acl.bestbits.at).
 
Old 07-25-2009, 12:17 AM   #9
shaunak
LQ Newbie
 
Registered: Jul 2009
Location: Mumbai, India
Distribution: Fedora
Posts: 8

Rep: Reputation: 0
My home directory is currently set to permissions: 700 [drwx------] (default)
I would have to run "chmod 711 shaunak" to be able to run the site inside wouldn't I? (Because I am currently getting a 403 error )

===
Also,
I have set up serving pages from the user directory by entering "UserDir enabled shaunak" and "UserDir public_html" directives in the httpd.conf
Is this OK or is there a better way to do it?

Last edited by shaunak; 07-25-2009 at 12:35 AM.
 
Old 07-26-2009, 05:37 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
For Apache's UserDir directive to work 0711 is OK but 0701 will actually work as good as well.
 
  


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
How do I give a user permission to save files to /var/www/html? rotnay6000 Linux - Newbie 10 07-14-2009 08:45 PM
Symbolic Link For FTP Access To /var/www/html ERRRRRRRRRRRR! JustinK101 Linux - Software 3 01-31-2007 11:32 AM
How do I give access to an ftp user to the var/www/html dir shootinstr8 Linux - Newbie 1 10-13-2006 03:32 AM
user/group permissions for /var/www/html/ illtbagu Linux - Software 6 11-12-2003 05:29 AM
Giving a user CHMOD rights to the /var/www/html directory? scubes13 Linux - Networking 3 08-18-2002 03:38 PM

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

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