Page 1 of 1
Problem with symlinks
Posted: Sat Jul 16, 2005 4:52 am
by skarecrow
I am working on a website that creates a temporary directory when a user logs in. When they browse the site, any content they would be accessing should be getting symlinked to that temporary directory so they never know the exact directory the files are in. I am able to create the directory just fine, and create the symlinks as well, but when a user tries to click on the actual content, they get an error... "You don't have permission to access /users/ecc3d1beebc167a61504f4c68db90309/20050511_1_1_8.mpg on this server." I was told this is a very common problem, but I haven't the slightest clue how to resolve it. Can't someone please help me out? I've tried setting the temporary directory AND the actual content directory to 777, and it still gives the same error. I'm running php 4.3.11 and Apache 2.0.54 on kernel 2.4.30-grsec. Thanks in advance for any help.
Posted: Sat Jul 16, 2005 6:14 am
by neophyte
I'm guessing the owner of the file is someone other than www. Or it belongs to someone who is not in the right group. That's where I'd start looking. You'll need chown chgrp to make a change in that regaurd.
Posted: Sat Jul 16, 2005 6:41 am
by timvw
You need to enable the FollowSymlinks option..
After that you may need to have a look at php configuration (safe mode) too..
Posted: Sat Jul 16, 2005 12:56 pm
by skarecrow
I've tried changing the owner AND enabling FollowSymlinks, but neither seems to do anything at all. Maybe I didn't enable FollowSymlinks correctly, can someone post an example?
Posted: Sat Jul 16, 2005 2:25 pm
by Chris Corbyn
Hopefully not being to patronising but did you restart the web server?
Posted: Sat Jul 16, 2005 2:35 pm
by skarecrow
Of course I did, and that didn't fix it. I did figure it out though. I feel like such an idiot, the symlinks were pointing to the wrong place. They were pointing to a directory within the temp directory, which didn't exist, I forgot to .. before going in.
Posted: Sat Jul 16, 2005 3:23 pm
by timvw
If you use a shell like bash.. You can enable coloring... Broken symlinks will appear in red
Here's a part from my .bashrc
Code: Select all
# If running interactively, then:
if ї "e;$PS1"e; ]; then
# enable color support of ls and also add handy aliases
eval `dircolors -b`
alias ls='ls --color=auto'
alias dir='ls --color=auto --format=vertical'
alias vdir='ls --color=auto --format=long'
fi
Posted: Sat Jul 16, 2005 3:29 pm
by skarecrow
I'm aware of file/directory coloring. All of the symlinks are showing up as the same color, whether they are broken or valid.
Posted: Sat Jul 16, 2005 6:00 pm
by timvw
Well, can only advise you to change your configuration
