3
votes

I followed this link to change group/user permission to add my self to www-data group but I am still unable to edit contents in /var/www , specially with uploaded content.

This is my development environments , I dont want to go to chmod /var/www/ each time there is an upload.

While keeping contents under /var/www what are the steps to change /var/www directory permissions to able to edit contents directly from and an IDE

My login account user and group name is debianaut:

 groups www-data
 www-data : www-data debianaut

 groups debianaut
 debianaut : debianaut www-data

I login/out after making these changes. It seems straight forward that if I am user of cretain group I should get whatever permissions they hold .

please help resolve this issue

4
What are the permissions on uploaded files?Joni
Are these files uploaded via FTP ?Kristopher
no through web browser , e.g joomla component installsakhunzai
My guess you have to change the default file mask (for uploaded files) in joomla settings then.Kristopher
@soulreaver please elaborate little bit , which setting and from where ?sakhunzai

4 Answers

3
votes

I suspect your issue is the fact that the user account has more than one group, and the default group is not the one with write permission to that folder.

While Linux allows your user access to multiple groups, it does not provide access to all of them at once. Here are some options to address this:

  • Change the group used while running in a shell
  • Change the user's default logon group
  • Use ACLs

New Group in a Shell

In order to operate as a different user after starting a shell, use newgrp.

Change default Group

In order to change the user's default group, edit /etc/passwd, or use a command to do the job (not sure which command, and it probably differs from distribution to distribution).

ACLs

You will likely prefer to use ACLs. See the man pages for setfacl and getfacl. ACLs (access control lists) are expanded permissions. Not all Linux systems support them, but I would be surprised if your Debian system doesn't. The following should add read-write-execute permission for user debianaut to all of /var/www:

setfacl -R -m u:debianaut:rwx /var/www

By the way - you can check the group id of a running process (such as your IDE), use ps -o gid -p <pid>.

Inheriting ACLs

Following the post here lead to the answer for inheriting ACLs.

The answer is called default ACLs in the man page. The following will set the ACL for denianaut as the default for files created in /var/www:

setfacl -R -d -m u:debianaut:rwx /var/www
2
votes

I think you should change your umask to 0002:

umask 0002

This could also be useful.

0
votes

For me the problem has to do with joomla configuration. You need to change the default permissions for uploaded files. This link may help you: http://forum.joomla.org/viewtopic.php?t=286584

0
votes

There are two relatively simple options, none of them should involve www-data -- you don't want the webserver to have unnecessary write access to your contents.

1) Just take ownershop of /var/www for your userid that will edit the files.

2) Establish a new group, make it one of your secondary groups, and make /var/www group-writable + setgid (chmod g+s) that new group. New files in the setgid dir will have their group set to the shared group.