Problem with permissions when syncing to sites directory

2

Is there a way to symbolically link a directory using ln to my ~/Sites/ directory on OS X so that the permissions are correct so it may be viewed in a web browser when I'm doing web development on a local machine?

This is what I did ln -s ~/code/web/yolkportfolio ~/Sites/yolkportfolio I then chmod 755 on the directory but it still isn't readable.

Any help would be greatly appreciated.

yolk

Posted 2011-08-22T17:14:34.953

Reputation: 141

What are the permissons on the link? – sbtkd85 – 2011-08-22T17:33:38.780

755 are the permissions. – yolk – 2011-08-22T22:19:54.887

Answers

2

The problem was with my apache config. Here is what allowed it to work, just the FollowSymLinks rule.

<Directory "/Users/Joe/Sites/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

yolk

Posted 2011-08-22T17:14:34.953

Reputation: 141

0

You have a couple of options:

1. If you are running apache with a different user (not yours), and definitively want the DocumentRoot to point to some directory inside your home, you meed to change permissions to your home directory (defaults must be 750 or 700) to 755

I'd only recommend this if this is your laptop or your personal computer and no one else has access to it.

2. The first one is not an option but you still want the DocumentRoot inside your home, then you can change the user who runs apache. Edit its configuration file and look for directives User and Group.

3. Second one is still not an option, and still ... you want things inside your home. Use apache's mod_userdir. With the following configuration:

<IfModule mod_userdir.c>
        UserDir public_html
        UserDir disabled root

        <Directory /home/*/public_html>
                AllowOverride FileInfo AuthConfig Limit Indexes
                Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
                <Limit GET POST OPTIONS>
                        Order allow,deny
                        Allow from all
                </Limit>
                <LimitExcept GET POST OPTIONS>
                        Order deny,allow
                        Deny from all
                </LimitExcept>
        </Directory>
</IfModule>

This is the default configuration for Apache's mod_userdir on Debian. You will be able to access:

/home/your-username/public_html/*

on your browser at the following address:

http://somewhere/your-username/*

4. Finally, you could place DocumentRoot somewhere else (/srv/www, /opt/www or whatever) and setup permissions as needed.

Torian

Posted 2011-08-22T17:14:34.953

Reputation: 603

I've done what you said with permissions but I'm still getting problems while trying to access the directory. I still get 403: Forbidden – yolk – 2011-08-24T15:15:08.763

Can you post your apache's config files ? – Torian – 2011-08-24T16:22:31.183

My apache config file may be seen here.

– yolk – 2011-08-25T17:28:16.580

Post the exact command you used to change permissions – Torian – 2011-08-25T18:16:44.923

chmod -R 755 ~/Sites/yolkportfolio/ which is symlinked to my ~/code directory. – yolk – 2011-08-26T20:34:11.820

That is exactly your problem. You have chmoded the directory that is inside your home, but the problem is your home's permissions. If you choose to change permissions, then chmod 755 ~/ is what you want. – Torian – 2011-08-27T00:57:24.170