Page 1 of 1

[Solved] Error 403 for my files

PostPosted: 28. November 2014 10:43
by cpighin
:) Hi,

I read topic Error 403 for phpmyadmin [Solved] and I ask for the community help for my problem which is a little different.

As a matter of fact, I get Error 403 assessing my web pages saved in /opt/lampp/htdoc/PHPaccessoDB_claudioSoloServerLocale (the wording in bold is the directory name where my files are loaded. I insert http://localhost/PHPaccessoDB_claudioSoloServerLocale/index_css.htm into the browser.

Consider that I can assess without problems pages:
http://localhost/phpmyadmin
http://localhosr/xampp
and that permissions of folders/files inside /opt/lampp/htdoc are the following:
Code: Select all
rw-r--r-- 1 root    root     1440 apr  4  2014 applications.html
-rw-r--r-- 1 root    root     2142 apr 29  2013 bitnami.css
-rw-r--r-- 1 root    root    30894 mag 11  2007 favicon.ico
drwxr-xr-x 2 root    root     4096 nov 19 15:42 img
-rw-r--r-- 1 root    root      256 feb  5  2009 index.php
drwxrwx--- 7 claudio claudio  4096 giu  2  2013 PHPaccessoDB_claudioSoloServerLocale
drwxr-xr-x 2 daemon  daemon   4096 nov 19 16:26 webalizer
drwxr-xr-x 7 root    root     4096 nov 19 16:26 xampp

and those of folders/files inside /opt/lampp/htdoc/PHPaccessoDB_claudioSoloServerLocale are as follow:
for file, like this
Code: Select all
-rw-rwxr-- 1 claudio claudio 11576 dic 14  2005 AggRecordAnagrafica_css.php
for directories like this
Code: Select all
drwxrwx--- 3 claudio claudio  4096 giu  2  2013 _mmServerScripts

I Installed XAMPP for Linux 1.8.3-5 few day ago.

I think that my problem affects a permission issue, but I'm not sure and not enough expert to manage safely the situation.

Thanks, Claudio :)

P.S.
I couldn't find a way to edit url wording. In my new post panel I see that "[url] is OFF". How can I switch it ON?

Re: Error 403 for my files

PostPosted: 28. November 2014 18:23
by Nobbie
>drwxrwx--- 7 claudio claudio 4096 giu 2 2013 PHPaccessoDB_claudioSoloServerLocale

This is insuffient, Apache is executed by a different User and different Group than "claudio", but only User claudio and Group claudio may read and access that folder. You have to grant access to that folder for "all", you can do that by this command in a shell:

Code: Select all
sudo chmod 0777 /opt/lampp/htdocs/PHPaccessoDB_claudioSoloServerLocale


Enter your password when asked.

cpighin wrote:How can I switch it ON?


You cannot switch it on, this is a SPAM related feature. It is automatically switched ON after a couple of posts (new Users are prohibited to post URLs).

Re: Error 403 for my files

PostPosted: 29. November 2014 09:46
by cpighin
:) thank you very much Nobbie :D

After comand
Code: Select all
sudo chmod 0777 /opt/lampp/htdocs/PHPaccessoDB_claudioSoloServerLocale
permissions of my sites folder are been changed in
Code: Select all
drwxrwxrwx 7 claudio claudio  4096 giu  2  2013 PHPaccessoDB_claudioSoloServerLocale
and I got access to my html pages :D

I will insert [Solved] in the first Subject post ad I would ask a couple of questions to learn something more:

- would I have had the same result changing group and owner in "root" to mentioned folder?

- if the answer is YES, which command should I have used?

Claudio :)

Re: Error 403 for my files

PostPosted: 29. November 2014 11:56
by Nobbie
cpighin wrote:- would I have had the same result changing group and owner in "root" to mentioned folder?


No. This would make it even worse.

Instead you may at least change group to the Group, which is specified in httpd.conf (you will find a "User = ...." and a "Group = ...." line in httpd.conf, this specifies the user and the group, which executes Apache).

cpighin wrote:which command should I have used?


a) the command is called "chown" and "chgrp".

b) you should definately read some tutorials about the Linux Rights System! This is absolutely basic knowledge and you will need it in many cases.

Re: [Solved] Error 403 for my files

PostPosted: 29. November 2014 15:47
by cpighin
:) Nobbie,

I'll try to abuse your patience!

Thank you for the good advice about reading of Linux Rights and i'll try to look for something within my reach (I'm not young and I can hardly remember commands and concepts).

What I really need is a good guide to explain step by step how to safely manage an own site with XAMPP and Ubuntu (in which position to copy my directory with files php/html, which rights have to be given to that folder and which commands are necessary, etc.). Can you recommend something?

Now I'll go back to my problem, because now I did'nt noticed before a minor problem: although I can access regularly my site pages, inside index_css.htm page is not shown an image, saved in a sub folder.

I fear that, even in this case, it is a rights issue, but I can not get out.

Consider that the image is in the /opt/lampp/htdocs/PHPaccessoDB_claudioSoloServerLocale/Images and has the following attributes
Code: Select all
-rw-rwxr-- 1 claudio claudio 120097 November 15 2005 ...


Thanks :)

Re: [Solved] Error 403 for my files

PostPosted: 29. November 2014 17:55
by cpighin
:) I have tried with success to solve the problem of missing image. All worked well, but I guess it's not a good solution :(

I used command:
Code: Select all
sudo chmod -R 0777 /opt/lampp/htdocs/PHPaccessoDB_claudioSoloServerLocale

Consider that, after such a command, rights of files/directories inside opt/lampp/htdocs are not changed in respect to those reported above, while rights of files/directories inside folder opt/lampp/htdocs/PHPaccessoDB_claudioSoloServerLocale and its sub-folders, were as follow for files
Code: Select all
-rwxrwxrwx 1 claudio claudio 117405 nov 15  2005 ...
and for directories
Code: Select all
drwxrwxrwx 7 claudio claudio  4096 giu  2  2013 …


What you think about?

Claudio :)

Re: [Solved] Error 403 for my files

PostPosted: 01. December 2014 21:38
by cpighin
:) In this article

http://www.marcogiorgetti.com/2014/05/03/impostare-utente-e-gruppo-di-apache-in-ambiente-xampp/

(it is in Italian, but I guess there an equivalent article in English) I found a better solution that works fine for me :D

Claudio :)

Re: [Solved] Error 403 for my files

PostPosted: 01. December 2014 22:58
by Nobbie
cpighin wrote::) In this article

http://www.marcogiorgetti.com/2014/05/0 ... nte-xampp/

(it is in Italian, but I guess there an equivalent article in English) I found a better solution that works fine for me :D


Yes, that is also a good solution, but i was not sure, if you will understand it. It is (in fact) not "better", but it is good. But you may get problems, when configuring an FTP Server for your installation. Anyway, all these solutions requires basic Linux knowledge, at least for you to find out, which solution fits your needs better.

You should read some documentation about Linux and files rights systems in any case.

Re: [Solved] Error 403 for my files

PostPosted: 02. December 2014 14:13
by cpighin
:) Thanks Nobbie,

Claudio :)