Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Simple question and there is perhaps a simple answer.

I have several directories in my home folder that I would like to make available as a directory on my webserver. So, what I did was to create a symlink:

iMac:/Library/WebServer/Documents/ ls -ltr
-rw-rw-r--  1 root      admin     44 Nov 20  2004 index.html.en
-rw-rw-r--  1 root      admin  31958 May 18  2009 PoweredByMacOSXLarge.gif
-rw-rw-r--  1 root      admin   3726 May 18  2009 PoweredByMacOSX.gif
-rwxr-xr-x  1 mego  admin      0 Jan  6  2011 favicon.ico
lrwxrwxr-x  1 mego  admin     52 Jul 26 13:45 myadmin -> /Users/mego/Downloads/phpMyAdmin-3.4.3.2-english
iMac:/Library/WebServer/Documents/ ln -s /Users/mego/opt/rel/src/main/web/ rel
iMac:/Library/WebServer/Documents/ ls -ltr
-rw-rw-r--  1 root      admin     44 Nov 20  2004 index.html.en
-rw-rw-r--  1 root      admin  31958 May 18  2009 PoweredByMacOSXLarge.gif
-rw-rw-r--  1 root      admin   3726 May 18  2009 PoweredByMacOSX.gif
-rwxr-xr-x  1 mego  admin      0 Jan  6  2011 favicon.ico
lrwxrwxr-x  1 mego  admin     52 Jul 26 13:45 myadmin -> /Users/mego/Downloads/phpMyAdmin-3.4.3.2-english
lrwxrwx---  1 mego  admin     47 Oct 12 09:58 rel -> /Users/mego/opt/rel/src/main/web/

Permissions on /Users/mego/opt/rel are recursively set to a+rx so everybody can read and execute.

When I try to change the permission, i.e. "chmod a+rx rel" and "chmod -R a+rx /Users/mego/opt/rel", zero effect.

The output of

ls -ld / /Users /Users/mego /Users/mego/opt /Users/mego/opt/rel /Users/mego/opt/rel/src /Users/mego/opt/rel/src/main /Users/mego/opt/rel/src/main/web

iMac:~/ ls -ld / /Users /Users/mego /Users/mego/opt /Users/mego/opt/rel /Users/mego/opt/rel/src /Users/mego/opt/rel/src/main /Users/mego/opt/rel/src/main/web
drwxrwxr-t@ 39 root      admin  1394 Sep 14 15:30 /
drwxr-xr-x   7 root      admin   238 Aug 29 10:04 /Users
drwxr-xr-x+ 98 mego  staff  3332 Oct 15 10:59 /Users/mego
drwxrwxr-x  19 mego  staff   646 Oct 14 20:47 /Users/mego/opt/rel
drwxrwxr-x   5 mego  staff   170 May 31 08:01 /Users/mego/opt/rel/src
drwxrwxr-x   6 mego  staff   204 Oct 12 08:42 /Users/mego/opt/rel/src/main
drwxrwxr-x   5 mego  staff   170 Oct 12 08:42 /Users/mego/opt/rel/src/main/web
iMac:~/ 

Must be something related to users home folder. But strangely enough, another folder "myadmin" has correct permissions and it works. What am I doing wrong?

Thank you in advance.

share|improve this question
4  
Permissions on symbolic links have no effect. Check the permissions on the target file/directory. –  Baldrick Oct 12 '11 at 9:18
    
Thanks, as I said, the permission on the target dir is ok. –  user11498 Oct 12 '11 at 9:28
    
Does everyone have execute permission on each of the directories in that path? –  psusi Oct 12 '11 at 19:57
    
@psusi yes every folder in the path does! –  user11498 Oct 12 '11 at 23:17
1  
Please post the output of ls -ld / /Users /Users/mego /Users/mego/opt /Users/mego/opt/rel /Users/mego/opt/rel/src /Users/mego/opt/rel/src/main /Users/mego/opt/rel/src/main/web –  Gilles Oct 12 '11 at 23:39
show 1 more comment

2 Answers 2

up vote 1 down vote accepted

/Users/mego has an ACL that may be preventing access. That's what the + after the traditional unix permissions on the output of ls -l for this directory indicates. Run ls -lde /Users/mego to view this ACL.

Note that if a user is denied access to /Users/mego (what matters is the executable bit), it won't have access to anything under it. So if the web server user doesn't have execution permission /Users/mego, it doesn't matter that /Users/mego/opt/rel is world-readable: the web server user won't be able to reach that far. It doesn't matter that a symbolic link is involved, either: access through a symbolic link involves traversing the path to the target.

Use chmod to manipulate the ACL. The examples in the man page should get you going (if you can't figure out what you need from the examples, ask here, and post the output of ls -lde /Users/mego).

share|improve this answer
add comment

I believe that chmod will only affect the permissions of the target file/directory when used on a symlink. lchmod should change the permissions of the actual symlink.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.