Forums | Mahara Community
Support
/
Access denied - Mahara 1.2 view uploaded files
25 November 2009, 12:24
I get the following error when I try to view a file that has been uploaded:
Access Denied
You do not have access to view this page
Procedure:
1. I upload a file to the default directory2. Then try to view it
It is in the system:
/data/portails/tecfalabs/mahara/mahara_data/artefact/file/originals/34:
total used in directory 152 available 476841144
/data/portails/mahara/mahara_data/artefact/file/originals/37:
total used in directory 12 available 476840512
drwx------ 2 www-data www-data 4096 2009-11-25 17:08 .
drwx------ 13 www-data www-data 4096 2009-11-25 17:08 ..
-rwx------ 1 www-data www-data 1879 2009-11-25 17:08 37
Mahara shows the file (MY Portfolio->My Files)
Name Description Size Date
.....
Configuration
Mahara 1.2PhP Version => 5.2.6-3ubuntu4.2
Mahara config:
$cfg->wwwroot = 'http://tecfalabs.unige.ch/mahara/';
$cfg->dataroot = '/data/portails/mahara/mahara_data';
Apache config:
<VirtualHost *:80>
ServerName tecfalabs.unige.ch
DocumentRoot /data/portails/tecfalabs
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
*** Note:
Before I had a config like this and I got the same error:
# Alias /mahara /data/portails/mahara/mahara-1.2.0/htdocs
# <Directory /data/portails/mahara/mahara-1.2.0/htdocs>
# AllowOverride All
# </Directory>
Procedure:
1. I upload a file to the default directory2. Then try to view it
It is in the system:
/data/portails/tecfalabs/mahara/mahara_data/artefact/file/originals/34:
total used in directory 152 available 476841144
/data/portails/mahara/mahara_data/artefact/file/originals/37:
total used in directory 12 available 476840512
drwx------ 2 www-data www-data 4096 2009-11-25 17:08 .
drwx------ 13 www-data www-data 4096 2009-11-25 17:08 ..
-rwx------ 1 www-data www-data 1879 2009-11-25 17:08 37
Mahara shows the file (MY Portfolio->My Files)
Name Description Size Date
.....
Configuration
Mahara 1.2PhP Version => 5.2.6-3ubuntu4.2
Mahara config:
$cfg->wwwroot = 'http://tecfalabs.unige.ch/mahara/';
$cfg->dataroot = '/data/portails/mahara/mahara_data';
Apache config:
<VirtualHost *:80>
ServerName tecfalabs.unige.ch
DocumentRoot /data/portails/tecfalabs
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
*** Note:
Before I had a config like this and I got the same error:
# Alias /mahara /data/portails/mahara/mahara-1.2.0/htdocs
# <Directory /data/portails/mahara/mahara-1.2.0/htdocs>
# AllowOverride All
# </Directory>
Now the mahara htdocs has the name "mahara" and physically sits under the www root directory
Apache logs:
129.194.112.10 - - [25/Nov/2009:17:08:14 +0100] "POST /mahara/artefact/file/ HTTP/1.1" 200 843 "http://tecfalabs.unige.ch/mahara/artefact/file/" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5"
129.194.112.10 - - [25/Nov/2009:17:08:15 +0100] "GET /mahara/artefact/file/download.php?file=37&maxheight=20&maxwidth=20 HTTP/1.1" 403 1977 "http://tecfalabs.unige.ch/mahara/artefact/file/" "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5"
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] [WAR] 41 (lib/errors.php:494) Missing argument 1 for MaharaException::__construct(), called in /export/data/portails/tecfalabs/mahara/lib/file.php on line 61 and defined, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] Call stack (most recent first):, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * log_message("Missing argument 1 for MaharaException::__construc...", 8, true, true, "/export/data/portails/tecfalabs/mahara/lib/errors....", 494) at /export/data/portails/tecfalabs/mahara/lib/errors.php:446, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * error(2, "Missing argument 1 for MaharaException::__construc...", "/export/data/portails/tecfalabs/mahara/lib/errors....", 494, array(size 0)) at /export/data/portails/tecfalabs/mahara/lib/errors.php:494, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * MaharaException->__construct() at /export/data/portails/tecfalabs/mahara/lib/file.php:61, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * serve_file("/data/portails/mahara/mahara_data/artefact/file/re...", "Schneider-portrait100px.jpg", "image/jpeg", array(size 2)) at /export/data/portails/tecfalabs/mahara/artefact/file/download.php:98, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] , referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] [WAR] 41 (lib/errors.php:495) Undefined variable: message, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] Call stack (most recent first):, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * log_message("Undefined variable: message", 8, true, true, "/export/data/portails/tecfalabs/mahara/lib/errors....", 495) at /export/data/portails/tecfalabs/mahara/lib/errors.php:446, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * error(8, "Undefined variable: message", "/export/data/portails/tecfalabs/mahara/lib/errors....", 495, array(size 1)) at /export/data/portails/tecfalabs/mahara/lib/errors.php:495, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * MaharaException->__construct() at /export/data/portails/tecfalabs/mahara/lib/file.php:61, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] * serve_file("/data/portails/mahara/mahara_data/artefact/file/re...", "Schneider-portrait100px.jpg", "image/jpeg", array(size 2)) at /export/data/portails/tecfalabs/mahara/artefact/file/download.php:98, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:15 2009] [error] [client 129.194.112.10] , referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] [WAR] 5d (lib/errors.php:494) Missing argument 1 for MaharaException::__construct(), called in /export/data/portails/tecfalabs/mahara/lib/file.php on line 61 and defined, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] Call stack (most recent first):, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * log_message("Missing argument 1 for MaharaException::__construc...", 8, true, true, "/export/data/portails/tecfalabs/mahara/lib/errors....", 494) at /export/data/portails/tecfalabs/mahara/lib/errors.php:446, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * error(2, "Missing argument 1 for MaharaException::__construc...", "/export/data/portails/tecfalabs/mahara/lib/errors....", 494, array(size 0)) at /export/data/portails/tecfalabs/mahara/lib/errors.php:494, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * MaharaException->__construct() at /export/data/portails/tecfalabs/mahara/lib/file.php:61, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * serve_file("/data/portails/mahara/mahara_data/artefact/file/or...", "Schneider-portrait100px.jpg", "image/jpeg", array(size 2)) at /export/data/portails/tecfalabs/mahara/artefact/file/download.php:98, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] , referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] [WAR] 5d (lib/errors.php:495) Undefined variable: message, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] Call stack (most recent first):, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * log_message("Undefined variable: message", 8, true, true, "/export/data/portails/tecfalabs/mahara/lib/errors....", 495) at /export/data/portails/tecfalabs/mahara/lib/errors.php:446, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * error(8, "Undefined variable: message", "/export/data/portails/tecfalabs/mahara/lib/errors....", 495, array(size 1)) at /export/data/portails/tecfalabs/mahara/lib/errors.php:495, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * MaharaException->__construct() at /export/data/portails/tecfalabs/mahara/lib/file.php:61, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] * serve_file("/data/portails/mahara/mahara_data/artefact/file/or...", "Schneider-portrait100px.jpg", "image/jpeg", array(size 2)) at /export/data/portails/tecfalabs/mahara/artefact/file/download.php:98, referer: http://tecfalabs.unige.ch/mahara/artefact/file/
[Wed Nov 25 17:08:17 2009] [error] [client 129.194.112.10] , referer: http://tecfalabs.unige.ch/mahara/artefact/file/
thanx for any help with this :) - Daniel
PS: I know there are threads for this problem, but I have the vauge feeling that I did things right. Also, the cron job is running, I also ran it manually to see if there were any errors. Actually there were some (not enough memory, a lib missing, etc., but fixed ....)
25 November 2009, 13:18
Hi,
For some reason Mahara thinks that the file you're trying to serve is not inside its dataroot.
Are you using symbolic links or anything else weird like that?
25 November 2009, 13:28
Heh you are right. Thanx a lot, the problem is fixed :)
Never met that before (and in my life I installed dozens of portals). Indeed I had:
$cfg->dataroot = '/data/portails/mahara/mahara_data';
Fixed the path to:
$cfg->dataroot = '/export/data/portails/mahara/mahara_data';
I wouldn't call symbolic links "weird". I mean, in a Unix system you use these all the time and the OS itself also. I thought that php would just use "normal" file access ;)
So indeeed I have this at the root directory:
lrwxrwxrwx 1 root root 12 2009-08-23 23:37 data -> /export/data
25 November 2009, 14:27
Hi, I totally agree it should work with symlinks (and I meant symlinks as normal and the weird applied to any other thing that might be related ;) ) - maybe you could file a bug about this for us in the tracker :)
PHP has some functions to deal with resolving symlinks in paths, like realpath iirc.
Anyway, glad it's working now :)
25 November 2009, 16:26
We deliberately disable it working with symlinks as a security check - just so that someone can't get in and dump a symlink on the system to take control of all or part of dataroot.
If you want to allow it to work with a symlink, you can set $cfg->insecuredataroot = true; in your config.php.
25 November 2009, 17:52
Hi & thanks for the explanation :)
Maybe you could just produce some kind of error message in a future version and/or make it more explicit in the installation notes, though maybe I didn't read them well enough ;)
Btw. I manged the Moodle integration too an hour ago. So Mahara can be installed by most anyone in a few hours, even if things go wrong. All one needs is some reading/asking skills and a little bit of help from here :)
11 December 2009, 10:55
Hi,
I'm actually experiencing a very similar problem since we migrated to a new server. Users can upload files, but there is a problem trying to download a file once in Mahara. The error message we get is "Access Denied. You do not have access to view this page". Any ideas? I tried to follow the response to this post and while I have access to the server, I'm an instructional technologist not a systems and network admin, so I want to be sure I'm accessing the proper files before I make a change. Any help would be greatly appreciated! Thanks, Lauren
22 December 2009, 23:47
Hi Lauren,
I just ran into this problem myself on a client's server. It's possible that the dataroot specified in the config.php file on your new server has a symlink in it. I'm going to fix it for the next releases, but the best workaround is to change the directory specified in the $cfg->dataroot line in config.php so that it doesn't include any symlinks.
The other, less secure workaround is to add the line
$cfg->insecuredataroot = true;