0

When I try to list my files in chrome as david did in week 9 lecture, I get this error message:

Forbidden

You don't have permission to access / on this server.

I entered http://localhost and got the above error.

screenshot of a directory window in the appliance

This image shows the exact listing of my directory.

Any help will be highly appreciated.

2 Answers 2

0

Being unable to read the contents of a folder or file on the web server is usually due to having read permissions not being set. Try setting read permissions for all users like this:

chmod a+r ~/vhosts/localhost/public/*

The spec for pset7 has has some pointers on setting up permissions.

0

To be able to list directories in Chrome, try executing these commands in the terminal

cd ~/vhosts/localhost
chmod 755 public/

and delete any files named index inside public (e.g., index.html and/or index.php)!

If you then add any files within this directory, then following the pset specification page, for any PHP file, file, that you create, execute

chmod 600 file

and for any non-PHP file, file, that you create (or upload), execute

chmod 644 file

where file is the name of your file.

Also, make sure the files are accessible by jharvard:students. To make sure of that, open up the terminal and navigate to ~/vhosts/localhost/public/ (using the cd command) and list your files by executing

ls -l

If for example, you have a file named index.php, you should see something like

-rw-------. 1 jharvard students 123 Aug  2 02:23 index.php

If you see something other than jharvard students, execute

sudo chown jharvard:students file

where file is the name of your file (e.g., index.php).

Hope that helps!

4
  • Well, this would stop his program to work correctly...
    – Cygni_61
    Aug 1, 2014 at 12:46
  • @Cygni_61 which program exactly, Luigi?
    – kzidane
    Aug 1, 2014 at 12:47
  • The web application in index.php :-P
    – Cygni_61
    Aug 1, 2014 at 12:48
  • @Cygni_61 just to make things clear, he's not trying to run any php programs, he's just trying to list directories within Chrome. However, I added a section, as you suggested, to change the permissions of files appropriately.
    – kzidane
    Aug 2, 2014 at 6:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .