Link to home
Start Free TrialLog in
Avatar of liveaspankaj
liveaspankajFlag for Nepal

asked on

file permission to particular folder for a few users

Hi Friends


I want to add file edit permissions for /var/www/html to few users. How do i do that?
ASKER CERTIFIED SOLUTION
Avatar of Kerem ERSOY
Kerem ERSOY

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kerem ERSOY
Kerem ERSOY

Opps my bad:

chmod -R g+w /var/www/html

now that the permission on the directory should look like this

# ls -al /var/www/html
total 4660
drwxrwxr-x 36 root root  12288 Apr 25 01:44 .
drwxr-xr-x 12 root root   4096 Apr 11 18:59 ..
-rw-rw-r--  1 root root  72545 Jul 20  2009 index.html


So that any user in apache group could modify the contents.

Please note the italic parts. This is the group information writable to the group members.


@Abhishek_Chib: Only this is different since he should make the users into an existing group (apache or www depending on the distro) not to create a new group from the scratch.
Avatar of liveaspankaj

ASKER

all lines in group file ends with ":"? i feel. do i need to end that line with colon as well.

i see an existing etry as
apache:x:48:

do i append user1,user2 to that?
all lines in group file ends with ":"? i feel. do i need to end that line with colon as well.

i see an existing etry as
apache:x:48:

do i append user1,user2 to that?

Yeah it should look like:
apache:x:48:user1,user2,user3

when you finish.
"man setfacl"


wmp
apache:x:48:user1,user2,user3
or
apache:x:48:user1,user2,user3:


it should be:

apache:x:48:user1,user2,user3

you have already left the ":" where it was.
[root@sp4064 pankaj]# ls -al /var/www/html/
total 88

drwxrwxr-x  7 root root 4096 May  1 09:37 .
drwxr-xr-x  6 root root 4096 Apr 25 15:30 ..
-rw-rw-r--  1 root root  135 Apr 25 10:51 abc.php
-rw-rw-r--  1 root root   57 Apr 21 10:43 abd.php
-rwxrwxr-x  1 root root    6 Mar  9 06:37 index.html
-rw-rw-r--  1 root root 5332 Mar 17 05:02 openfire.html
-rw-rw-r--  1 root root   50 Apr 21 09:41 phpinfo2.php
-rw-rw-r--  1 root root   20 Apr 21 10:15 phpinfo3.php
-rw-rw-r--  1 root root   20 Apr 21 10:35 phpinfo4.php
-rw-rw-r--  1 root root   20 Apr 21 10:41 phpinfo5.php
-rw-rw-r--  1 root root   20 Apr 21 09:22 phpinfo.php
drwxrwxr-x 11 root root 4096 May  1 09:39 phpmyadmin
drwxrwxr-x  3 root root 4096 Apr 25 15:31 svn
drwxrwxr-x  2 root root 4096 Apr 21 10:24 xmppchat
oh your document root has been owned by root not apache...
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
why not do:


chown -R root.apache /var/www/html


i already have users added to apache :P
you'd better use chgrp instead of directly modifying the group file:

chgrp -G www user1

> why not do:


> chown -R root.apache /var/www/html


> i already have users added to apache :P

The daemon runs as group apache. Practically any one hacking into your system will  be able to write files and directories. The whole idea is to separate serving the files and editing the files.

okiee great i will change to www then
works great now
thanks
You're welcome