Page 1 of 1

Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Sun Oct 02, 2022 8:55 am
by caigner
Hallo!

Eigentlich hab ich etwas sehr triviales gemacht: Ich habe mit dem File Manager eine PDF-Datei in den /uploads/doc-Ordner hochgeladen.
Danach habe ich im Content meiner Seite mit dem WYSIWYG-Editor einen Link zu diesem Dokument eingefügt.

Der Link sieht so aus:
Soweit alles ok. Nur wenn ich auf der Webseite dann den Link anklicke, erhalte ich folgende Meldung:
403 Forbidden
You don't have permission to access this resource.
Ich nehme mal an, ich muß in einer der .htaccess-Dateien etwas ändern, aber was?

Vielen Dank schon mal im Voraus für die Hilfe!

Christian

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Thu Oct 20, 2022 8:55 am
by creopard
Hallo Christian,

ich denke, das hat weniger mit CMSMS zu tun als mit der Berechtigung (chmod) und dem Besitzer deines Verzeichnisses "/uploads/doc/".
Wie sieht denn das chmod vom Verzeichnis "doc" aus? "755"?
Wer ist der Besitzer des Verzeichnisses?
Welche Berechtigung hat die PDF-Datei selbst? "644"?

VG
1541

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Mon Oct 31, 2022 11:26 am
by caigner
Das Verzeichnis "doc" hat 775 und die PDF-Datei hat 644.
Es sollten also alle Website-Besucher lesenden Zugriff darauf haben.

Besitzer des Verzeichnisses ist der selbe, dem auch das uploads-Verzeichnis gehört. Ich habe das Verzeichnis in der Admin-Umgebung mittels File-Manager angelegt. Sollte also alles passen. Deshalb bin ich auch so überrascht, daß es nicht geht.

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Mon Oct 31, 2022 2:00 pm
by DIGI3
(Sorry for the English) - check your .htaccess file, the one that ships with CMSMS has this line:

Code: Select all

RedirectMatch 403 ^.*/doc/.*$
You'll need to change it to be more specific to the site root /doc/ folder.

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Thu Jan 19, 2023 2:21 pm
by caigner
So, what should

Code: Select all

RedirectMatch 403 ^.*/doc/.*$
look like, so that a PDF can be downloaded? Should I remove it from the .htaccess file?

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Thu Jan 19, 2023 3:19 pm
by DIGI3
Comment it out to confirm it fixes the issue, then I think you could change it to

Code: Select all

RedirectMatch 403 ^/doc/.*$
to block just the root /doc/ folder and its contents, but not any folder with the name 'doc'.

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Thu Jan 19, 2023 4:03 pm
by caigner
Commenting out worked! Thanks for your help!

Re: Link zu PDF-Datei ergibt "You don't have permission to access this resource."

Posted: Fri Jan 20, 2023 10:34 am
by creopard
I'd recommend you keep the original htaccess rule, because now everybody can download the file

Code: Select all

rootdir/doc/CHANGELOG.txt
and can determine your current CMSMS version which could be a security concern.
Maybe you should rename your document directory from

Code: Select all

rootdir/uploads/doc/
to

Code: Select all

rootdir/uploads/dokumente/
This way the current htaccess rule

Code: Select all

^.*/doc/.*$
won't match anymore and the downloads will work.