Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been told that I should create a images folder and an assets folder, and that I needed to make sure that: "they are apache writable". I've also been told to make the app/runtime directory web-writable. Is this the same as apache writable? If so:

How can I do that at once, or know that ?

Doing a ls -l I'm getting something like:

drwxr-xr-x 13 user user 4096 2011-08-26 10:23 app
drwxr-xr-x 4 user user 4096 2011-08-26 10:23 runtime
drwxr-xr-x 2 user user 4096 2011-08-26 11:11 images
drwxr-xr-x 2 user user 4096 2011-08-26 11:12 assets
share|improve this question
    
I answered based on the 1st version of your question. I think I still have it all covered. If not PM me! –  Rinzwind Aug 26 '11 at 10:49

1 Answer 1

up vote 13 down vote accepted

Apache, is a program running in the background. Apache is originally started by user root (also called root-process). This root-process launches several child processes which handle the client requests. For security reasons, the child processes are not run by user root but as a user with minimal privileges. Usually this user is named apache or www-data.

To find out what user this is for apache v1:

ps -ef | grep httpd | grep -v grep

or for apache v2:

ps -ef | grep apache | grep -v grep

Result for apache 2 will be something like this:

root      5001     1  0 07:21 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  5021  5001  0 07:21 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  5022  5001  0 07:21 ?        00:00:00 /usr/sbin/apache2 -k start
www-data  5023  5001  0 07:21 ?        00:00:00 /usr/sbin/apache2 -k start

In this case the user/group is www-data

So, in order to make a directory writable by the webserver we have to set the directory’s owner or group to Apache’s owner or group and enable the write permission for it. Usually, we set the directory to belong to the Apache group (apache or `www-data or whatever user is used to launch the child processes) and enable the write permission for the group.

chgrp www-data /path/to/mydir
chmod g+w /path/to/mydir

(www-data is the name you found with the ps command above).

Regarding:

2) I've also been told to make the app/runtime directory web-writable. Is this the same as apache writable ?

Yes, this is a directory you need to set writable to the group Apache expects. Probably this will be somewhere in /var/www/ or it is set as a virtual host in /etc/apache2/sites-enabled/ and/or /etc/apache2/sites-available

share|improve this answer
    
Thanks a lot. Is there a way to create the directory with mkdir and at the same time, give those permissions ? –  MEM Aug 26 '11 at 10:50
    
Is it true that we can also do: chmod -R o+w /or/path/here ? (the -R being option obviously). ? –  MEM Aug 26 '11 at 10:51
    
Yes 1 method would be: mkdir dirname && chgrp www-data dirname –  Rinzwind Aug 26 '11 at 10:53
    
@MEM yes. R will do all dirs from where you issue the command. There are a lot of ways to do this ;) –  Rinzwind Aug 26 '11 at 10:54
    
Thanks a lot. Really. Glad to know a little bit more. :) –  MEM Aug 26 '11 at 10:56

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.