Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an account on a hosted webserver, where I have SSH access.

Files put in /home/sandra/public_html are online.

DokuWiki recommends that the data and conf directory is not in Document Root, so I have moved them to /home/sandra/data/ and /home/sandra/conf.

The problem is, that apache can't write to these directories.

Ownership of /home/sandra/ is sandra.sandra.

Question

Are there other solutions to this problem than

chmod 777 /home/sandra

Can the root user help me out?

share|improve this question
2  
Hello Sandra, Changing the ownership of the directory you want your web server to write to the users who is running web server will fix the issue. –  Hex Sep 1 '12 at 16:04

2 Answers 2

up vote 2 down vote accepted

As Hex already wrote, the directory must be writable for the user under which Apache runs. You can achieve this by changing the group to the Apache user's primary group (www-data on Ubuntu) and give the group write permission.

chgrp -R www-data /home/sandra/data /home/sandra/conf
chmod -R g+rwX /home/sandra/data /home/sandra/conf

The user must also be able to cd into those directories, so it needs execute permissions on the parent directory.

chmod o+X /home/sandra

Another option would be to add respective ACLs for the Apache user, if the filesystem supports them.

setfacl -m default:u:www-data:rwx /home/sandra/data /home/sandra/conf
setfacl -m u:www-data:x /home/sandra

I wouldn't recommend changing the owner.

share|improve this answer

You can try

chown -R apache /home/sandra/conf 

This command will make apache the owner of these files. You can then give apache full access to the folderby doing

chmod 770 /home/sandra/conf

Both commands must be run on both folders respectively.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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