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.
Best Answer
/Users/mego
has an ACL that may be preventing access. That's what the+
after the traditional unix permissions on the output ofls -l
for this directory indicates. Runls -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 ofls -lde /Users/mego
).