Score:4

Allow a group of users to create and write to files in a given directory

th flag

I want to have different users including www-data to work together under a specific path. including updating each others files.

I made a new group webimage

addgroup webimage

and

adduser user1 webimage
adduser user2 webimage
adduser www-data webimage

I changed the permissions of the imagedir

chown -R www-data:webimage image/

and user1 can write but the file has permisions

-rw-rw-r-- 1 user1       user1

and no one can update the file but this user. How can I get this to work in a secure manner. Outside of this directory of course each users file is private as usual.

au flag
Having multiple devs work on the same machine is… very weird. What exactly did you have in mind?
th flag
@Alexander multiple person should be able to update images wich are also manipulated (scaled or cropped) by the webserver. I don't think it's weird (persons are not developers - in case you think on vcs)
Score:8
cn flag

You can set the setgid bit for that:

sudo chmod g+s image/

This will cause any file created in that directory to be owned by the same group as the directory. Thus, if image is owned by group webimage, any file created there will be owned by the group webimage. If also read and write permissions are set for the group, all members of the group will be able to update the file.

Marcelo Scofano Diniz avatar
ar flag
This is pure gold, thanks
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.