View Full Version : "permission denied" for Alias directory outside of www root
19th February 2006, 16:49
I've got a problem that is absolutely driving me bonkers. I am hosting a clan website. We play a bunch of different mods and I use Psychostats for four or five of them. What I used to do when the OS was Windows was I set up virtual directories and hosted the stats for each mod in those directories. However, under GNU/Linux, I am unable to get this to work. It seems that no matter what I do I get permission denied errors. I have tried chmodding the directories to 777 even, but I still get permission denied. I've tried defaults for the partition in /etc/fstab, but no joy, so I know it isn't a conventional file/folder, or partition mount permissions problem.
This is an example of one of the virtual directories I am trying to host out of:
Alias /stats/tfc/ "/usr/games/hlds_l/tfc/addons/psychostats/stats/"
Allow from all
edit: I've also tried changing the ownership of the folders to apache2/apache2, which is what the server runs under.
19th February 2006, 19:27
Do you see error messages in the Apache error log?
19th February 2006, 19:32
[Sun Feb 19 10:45:51 2006] [error] [client 192.168.0.1] (13)Permission denied: access to /stats/tfc/index.html denied, referer: http://www.crazy-canucks.com/page.php?url=http://www.crazy-canucks.com/stats/tfc/index.html
As I said, the error is basically "Permission denied".
I am using NukeWrapper to wrap the pages, but I get the same error when I try to access the page directly. I also get the same error if I try to access the page from within the lan using the internal lan url.
edit: I also had a similar problem trying to create an aliased directory for my phpBB attachment upload folder. What I also find odd is that the alias folder for the icons folder seems to work just fine. I was thinking maybe it was because the website files and the alias directory were on different partitions, but the icons folder is on a different partition, and a different hard drive actually...
19th February 2006, 23:36
Can you post the output of ls -la /usr/games/hlds_l/tfc/addons/psychostats/stats/ and all other directories in the path?
Does /stats/tfc exist?
20th February 2006, 00:31
/stats/tfc does not exist as a actual directory.
I'm not going to post the entire output from ls -la but I'll post for the stats directory, as well as a representative sample (lots of files in the directory).
drwxr-xr-x 3 root root 4096 2006-02-16 16:30 stats
contents of /stats
drwxr-xr-x 3 root root 4096 2006-02-16 16:30 .
drwxr-xr-x 4 root root 4096 2006-02-16 16:30 ..
-rw-r--r-- 1 root root 11661 2006-01-08 08:11 award_deathstreak.html
-rw-r--r-- 1 root root 11618 2006-01-08 08:11 award_kdr.html
-rw-r--r-- 1 root root 11631 2006-01-08 08:11 award_killstreak.html
-rw-r--r-- 1 root root 11637 2006-01-08 08:11 award_kpm.html
-rw-r--r-- 1 root root 9934 2006-01-08 08:11 awardlist.html
the /stats/_image directory
drwxr-xr-x 6 root root 4096 2006-02-16 16:30 _images
*I named the folder _images a long time ago with some vague idea that it was good for security but never got around to renaming it...
**I think I already mentioned that I tried chmod -R 777 stats and it made no difference, although it does strike me as odd that the directory is 755 and the contents are 644, I was sure that I had used chmod -R which should have meant the files and folder were chmodded the same.
I'm wondering if this is somehow a pam problem, although I don't know how to disable pam simply without screwing everything up to see if it is pam that is causing the problem.
edit: There actually is another problem, I didn't mention it because I didn't think it was related, and I wanted to solve this problem first, but I'm wondering if it is related. I can load index.php files without a problem, and they work normally, but if I have a directory with an index.html file, it will only load the index file if I don't directly reference it and only use the directory in the usl.
http://www.foo.com/foo/ will load
http://www.foo.com/foo/index.html will not load and will only load the root index.php file for the entire site, but without any of the links or images in place, as though it is loading it in that directory so all the links are broken. Also, even though the index.html file will load if I reference the folder, none of the links directly to files (ex: http://www.foo.com/foo/bubbles.html) will load and the result will be the root index.php file loading with broken links and images.
edit: I meant to say, as far as I know I've got DirectoryIndex configured properly - "DirectoryIndex index.html index.php" Those two are all I use on my site.
All in all, Apache is behaving very strangely for me on Debian whenever I try to access any index files not in the root web directory.
I'm beginning to wonder if what I need to do is compile Apache2 myself and say **** it to the Debian package.
edit again: After I wrote the above line I realized that if I was to compile Apache, I'd have to do the same for PHP and MySQL. Not a pleasant thought...
20th February 2006, 02:30
Well I've found a solution. Its not a solution that I particularily like, but at least it works. I moved the stats directories into the www folder so now the stats directories are "/var/www/stats/firearms/", "/var/www/stats/dod/", etc. This seems to work just fine. I wonder if something has been compiled into the Debian Apache2 that forces you to use this directory to make it easier to chroot Apache or to get it to work with the apache chroot package? But what I don't get is why those other directories work. I have downloads set up in /var/public/updownload/ and that directory seems to work just fine, although there are no html files in it, and it can't be indexed. *sigh* I just don't get it, but at least it is working. If you find a solution that allows me to choose the directories I would have preferred to use, please share it, otherwise I guess I'll just settle for this and move on...
20th February 2006, 15:58
I wonder if something has been compiled into the Debian Apache2 that forces you to use this directory to make it easier to chroot Apache or to get it to work with the apache chroot package? But what I don't get is why those other directories work. I have downloads set up in /var/public/updownload/ and that directory seems to work just fine, although there are no html files in it, and it can't be indexed. *sigh* I just don't get it, but at least it is working. If you find a solution that allows me to choose the directories I would have preferred to use, please share it, otherwise I guess I'll just settle for this and move on...
You should have a look at all the <Directory ...> settings in your Apache configuration. I think it has something to do with that.
21st February 2006, 01:40
Trust me, I've combed through all of them, more than once. However, there is always a chance I missed something because there are a fair number of places where Debian hides its Apache configuration files. I'm sure it is set up to facilitate large scale commercial web hosting, but all I am hosting is one website and the Debian Apache configuration is a bit more complicated than I am used to, or than is necessary for my purposes. But its all good, I'm learning alot, and now I've got everything working, so I have no real complaints.
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.