3

I can not get the page https://ide50-username.cs50.io/ to work The phpmyadmin i can enter.

I have followed the instructions given and ive tried to re do it if i missed something but that where not the case.

I tried to delete all an redo the whole pset7 I tried to re set all chmod stuff and restart the apache50 with $apache50 restart But did not help either.

I did some research online on how to fix this and ofc i can chmod -R 755 for the whole project and get it to work, but i have a feeling that this will be a big set back for me later.

Here is my error log output from ~/lib/apache2/log/error.log:

$tail -f ~/lib/apache2/log/error.log
[Mon Sep 19 15:06:05.176235 2016] [core:error] [pid 50306] (13)Permission denied: [client 10.240.1.18:34742] AH00035: access to / denied (filesystem path '/home/ubuntu/workspace/pset7/public') because search permissions are missing on a component of the path

I am not familiar with apache-servers so i have no idea what to do now.

1

First of all, let's look at the error message from the Apache2 logs:

(13)Permission denied: [client 10.240.1.18:34742] AH00035: access to / denied (filesystem path '/home/ubuntu/workspace/pset7/public') because search permissions are missing on a component of the path

What this means is that one or more of the parent directories on your full path to the Apache2 root will need to have its permissions set to chmod 711.

chmod 711 ~/workspace/pset7/public
chmod 711 ~/workspace/pset7
chmod 711 ~/workspace
chmod 711 ~

And, if necessary:

sudo chmod 711 /home
sudo chmod 711 /

These last two should not be necessary, but I'm including them for completeness. (And as always, if you use sudo for anything, be extremely careful where you point that shotgun -- it's loaded!)

By the way, that's my Definitive Guide to permission problems that Jake has linked to. I hope it helps you to get your permission issues sorted out in short order.

I encourage you to read the whole thing and teach yourself about the find | xargs pipeline. If you're looking for the Cliff's Notes, just remember these rules:

  • chmod 711 for all directories (chmod 755 is not necessary!)
  • chmod 644 for most web stuff (HTML, CSS, JavaScript, image files)
  • chmod 640 for PHP files and config.json in the CS50 IDE
    (chmod 600 should suffice in most other hosting scenarios)

As far as security, it's basically the best you can get with just chmod commands, subject to the limitations of the CS50 IDE.

I have tested these permissions carefully to verify that they are the minimum required permissions necessary for the site to work.

In general, if a permission is not needed (for either user, group, or world) then it is not granted. That's why you see chmod 640 for PHP files and config.json instead of chmod 644 -- because read-only permission is required for the group, but no permissions are required for the world.

Hope this helps!

| improve this answer | |
2

This guy had a solution. Not sure how good it is in security aspects though. https://m.reddit.com/r/cs50/comments/5055ti/403_forbidden_permissions_chmod_the_definitive/

cd ~/workspace/pset7
find . -type d | xargs chmod 711
find . -name *.php | xargs chmod 640
chmod 640 config.json
find . -name *.js | xargs chmod 644
chmod 644 public/css/*
chmod 644 public/img/*
chmod 644 public/fonts/*
| improve this answer | |
  • Thanks for the link! :) – hotwebmatter Sep 19 '16 at 18:48

You must log in to answer this question.

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