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 www-data (apache) and craig (me) as users on this Ubuntu 9.04 machine.

So I have a bunch of files that belong to the user 'www-data', but I can't write to them without either:

  • being root
  • chmod'ing the files so they are world-writeable
  • or chown'ing them so they are in my user group, then chmod'ing them so they are group-writeable.

Is there anything I can do so that my user (craig) by default has access to all of www-data's files as if they were my own files?

Perhaps I'm looking at the problem the wrong way - in which case, how should I be doing this?

Thanks!

share|improve this question
1  
How are the files from www-data created? –  Cristian Ciupitu Sep 20 '09 at 20:39
    
Maybe you are looking at the problem the wrong way, but it's hard to tell without knowing more about what files you're talking about, or why exactly you want to have permissions to edit them. –  David Z Sep 21 '09 at 1:57

4 Answers 4

You can add your user to the group www-data - that would give your access without giving every user on the system access (which is a dangerous thing to do especially in a shared environment). For example: useradd -G www-data your_user_name (there is almost certainly a GUI way of doing this too).

You may still need to chmod the files as they might not be writeable by the group by default. chmod -R g+rw <directory> would do this.

share|improve this answer

You could add yourself to the www-data group (by adding your username at the end of that line in /etc/group), and change apache's umask to 007 by adding the following line in /etc/apache2/envvars.

export umask 007

This means files created by apache will be 770 by default, allowing you to edit them.

share|improve this answer

Personally I would use sudo to gain access. What is the group permissions? You could also add yourself to the group that has access and chmod g+w on the files. Whatever you do DO NOT make it world write.

share|improve this answer

I'm trying to do something similar to this. Though i want to make the directories accessible by a group. So i can add users to the group and they can edit their webpages. I've been searching for help on this with google for about 2 hours now.

share|improve this answer

Your Answer

 
discard

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