Linux – Ubuntu Linux – Permissions – can I have all perm’s to another users files

apache-2.2linuxpermissionsUbuntu

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!

Best Answer

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.