2

i have a problem at granting the right rights for the right user...

i want to run pootle with apache, so i downloaded pootle. Then i copied it to /var/www, installed it and gave the www-data user rights for the whole folder. As far as good... now i want to copy the translated files from and to the translation-directory (e.g. /var/www/pootle/po/project).
So i created a group (www) added me to the group and executed

sudo chown -R :www /var/www/pootle

ok, so now i have rights to write files into the directory, however, when apache creates a file, its group is www-data...

sudo chmod -R g+s /var/www/pootle

ok, now the group is always "www", as i wanted it to be... now here is the problem:
When i write files to /var/www/pootle they are there, however, with my user as owner, and not, as i awaited, as www-data, although i executed the command:

sudo chmod -R u+s /var/www/pootle

is there a way that i can say that the user who created the file, even if its me, shall be www-data?

thx in advance :)

2 Answers 2

2

If you run chown without a preceding colon, you will change the owner. (With the preceding colon, you change the group, as you have demonstrated above, and you can also run chown -R new-owner:newgroup.) So if you just run

sudo chown -R www-data /var/www/pootle

you will change the owner to www-data.

"....when apache creates a file, its group is www-data..."

Can you clarify what you mean by this? Apache serves files, it doesn't create them. PHP creates them - but they are created dynamically and served directly to web clients (browsers), they are not created and then saved by Apache.

It seems your problem is with file ownership. If so, a more convenient approach might be to add pootle to the www group - as Apache (generally) needs htm(l) files to be owned by www to read them. Files then created by Pootle will have the same group ID and you won't need to run chown at all - Apache will have read access to Pootle's files. See http://translate.sourceforge.net/wiki/pootle/apache which says:

 You need to extract Pootle in a directory accessible to the apache user.

Make sure Apache has read access to all of Pootle's files and write access to the dbs and po subdirectories.

Hope this helps.

2
  • well, when i create a new project with pootle, it seems as apache - or at least the www-data user - creates the file, here is a project i just created: drwxr-sr-x 2 www-data www-data 4096 Sep 21 08:42 test2/ although i have changed the user of /var/www to my user and the group to www-data and... yeah, i forgot to write, i alrdy used -R ^^
    – greenit
    Sep 21, 2012 at 6:45
  • would it help if i use a symlink to just point to the directory in /var/www/pootle/projects and set the group there to www-data with g+s?
    – greenit
    Sep 21, 2012 at 6:57
1

Would it not be better to go:

chown -R greenit:www-data /var/www/
chmod -R 770 /var/www/pootle

I would not recommend the next bit (you should ideally manually chmod or chown files you create yourself), but you could add yourself to the www-data group:

usermod -a -G www-data greenit

However, the ideal thing would be to find the setting in Pootle that specifies what user to run as, and change that to www-data.

1
  • well, i already used the -R option, i just forgot to write it in the question^^ however, when i create a new project in pootle, it looks like the row, i added to the other answer, plz look at it, i don't want to to write a comment twice^^
    – greenit
    Sep 21, 2012 at 6:48

You must log in to answer this question.

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