1

I have made a raspberry pi web server with Apache, PHP, mysql etc... In the html folder where are all my .html and .php file I created a new directory called images. I put images into it. But when i try to see the directory in a web browser i get a permission denied 403 error.

enter image description here

Is there any command to authorize this ? Thank you ;)

  • who owns the folder? what are the permissions on the folder and files? – Steve Robillard Nov 29 '15 at 18:30
  • Hey thank you to help me again ;) Where do I get the permissions infos ? – Omid Nov 29 '15 at 18:31
  • ls -la remember that man ls you may also want to read this ibm.com/developerworks/library/l-lpic1-v3-104-5 – Steve Robillard Nov 29 '15 at 18:33
  • pi@192:~ $ sudo -la /var/www/html/images usage: sudo -h | -K | -k | -V usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user] usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user] [command] usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u user] [VAR=value] [-i|-s] [<command>] usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-u user] file ... – Omid Nov 29 '15 at 18:36
  • or this pi@192:~ $ ls -l /var/www/html/images total 0 – Omid Nov 29 '15 at 18:38
1

Once again the problem is ownership and permissions. To fix the problem do the following:

sudo chown pi:pi /var/www/html/images

and

sudo chmod 755 /var/www/html/images

also from the above it does not appear that you have any files in the images directory. You will need to make sure that the ownership and permissions are correct on them as well.

  • Is there a command to enable all the images of the directory with only one command ? – Omid Nov 29 '15 at 18:53
  • @Omid You need two commands one to change the ownership and one to adjust the permissions - check the man page for the recursive option for the chown and chmod commands man chmod and man chown. – Steve Robillard Nov 29 '15 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.