LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 08-16-2004, 10:12 PM   #1
rotnay6000
LQ Newbie
 
Registered: Jul 2004
Location: Neebraskee
Distribution: FC2, Suse91, Mandrake10
Posts: 21

Rep: Reputation: 15
How do I give a user permission to save files to /var/www/html?


I believe that I need to do a chmod on the var/www/html directory, or just the files in it - but I'm not sure.

TIA!!!

FedoraCore2, Apache 2.0
 
Old 08-16-2004, 10:17 PM   #2
redhatgeek
LQ Newbie
 
Registered: Jun 2004
Distribution: redhat/fedora
Posts: 24

Rep: Reputation: 15
you could put the user in the apache group or create a seperate group with r/w access to that dir and put the user in it
 
Old 08-16-2004, 10:26 PM   #3
xlordt
Member
 
Registered: Dec 2003
Distribution: Slackware
Posts: 32

Rep: Reputation: 15
chown -R {usersname} {path to file/dir}
 
Old 08-16-2004, 11:02 PM   #4
rotnay6000
LQ Newbie
 
Registered: Jul 2004
Location: Neebraskee
Distribution: FC2, Suse91, Mandrake10
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks for the quick response. The user is a member of the apache group (using gnome/system settings/users & groups). Is there a command I can use in a terminal to verify this?
 
Old 08-16-2004, 11:05 PM   #5
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,139

Rep: Reputation: 322Reputation: 322Reputation: 322Reputation: 322
Check that apache group has write access to /var/www/html to do so, type 'ls -ld /var/www/html', any tutorial on Unix permissions will tell you how to interpret the results (I think there's one in the answers section here, if not googling on Unix permissions will turn up plenty). Post here if you're confused. Also do id <username> or groups <username> to verify your user is a member of the apache group.
 
Old 08-17-2004, 09:42 AM   #6
rotnay6000
LQ Newbie
 
Registered: Jul 2004
Location: Neebraskee
Distribution: FC2, Suse91, Mandrake10
Posts: 21

Original Poster
Rep: Reputation: 15
Thanks for the help - it appears root is the owner, as ls -ld produces:

drwxr-xr-x 2 root root 4096 Aug 16 06:16 /var/www/html

So I guess I need to use CHOWN to change group ownership to apache instead of root as my user is a member of the apache group?

I am a little confused on the syntax of CHOWN to do that - I appreciate everyone's help!
 
Old 08-17-2004, 10:43 AM   #7
rotnay6000
LQ Newbie
 
Registered: Jul 2004
Location: Neebraskee
Distribution: FC2, Suse91, Mandrake10
Posts: 21

Original Poster
Rep: Reputation: 15
OK, I got it !!

Opened a terminal, logged in as su, then did:

chgrp apache /var/www/html

Then:

chmod 775 /var/www/html

THANKS FOR EVERYONE'S HELP!!!
 
Old 04-18-2007, 01:33 AM   #8
sfo_sc
LQ Newbie
 
Registered: Apr 2007
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by rotnay6000
OK, I got it !!

Opened a terminal, logged in as su, then did:

chgrp apache /var/www/html

Then:

chmod 775 /var/www/html

THANKS FOR EVERYONE'S HELP!!!
Ran into the same question and this thread solved my problem. Thanks!
 
Old 07-14-2009, 09:23 PM   #9
uvdevnull
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by rotnay6000 View Post
OK, I got it !!

Opened a terminal, logged in as su, then did:

chgrp apache /var/www/html

Then:

chmod 775 /var/www/html

THANKS FOR EVERYONE'S HELP!!!
Please correct me if I'm wrong, I'm fairly new to linux and apache but this sounds like a very bad idea. Aren't you in effect giving write permissions on all those files to anonymous browsers of your website? What I would do instead, as was suggested earlier, is create a new group (ie: webmasters), add the user to it and then chgrp and chmod for that new group.

Otherwise you're giving write perm to apache group, of which the apache user is a member, as which the httpd service runs.

I could be wrong, so double check me...
 
Old 07-14-2009, 09:40 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,541
Blog Entries: 54

Rep: Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924Reputation: 2924
While this is a necropost (a response to a thread that died long ago), I agree. Keeping the "least privilege" mantra in mind one should know when to rely on DAC rights or group membership and when to use ACL.
 
Old 07-14-2009, 09:45 PM   #11
uvdevnull
LQ Newbie
 
Registered: Jul 2009
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
While this is a necropost (a response to a thread that died long ago), I agree. Keeping the "least privilege" mantra in mind one should know when to rely on DAC rights or group membership and when to use ACL.
I normally don't resurrect old threads but I saw that people are still taking that bad advice years later
 
  


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
apache server setup and how to place files in the var/www/html directory dramous Linux - Newbie 7 09-28-2004 05:18 AM
apache server setup and how to place files in the var/www/html directory dramous Linux - Software 3 09-25-2004 03:38 AM
user/group permissions for /var/www/html/ illtbagu Linux - Software 6 11-12-2003 06:29 AM
Can't save files to /var/www/html/ Panopticon Linux - Newbie 14 09-12-2003 03:03 AM
Giving a user CHMOD rights to the /var/www/html directory? scubes13 Linux - Networking 3 08-18-2002 04:38 PM


All times are GMT -5. The time now is 03:50 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration