14.04 - FIle permissions within the same group

I have created a new group called "city". Added 2 users in that group:

  • admin
  • moderator

Changed the owner/group of a folder:

chown -R admin:city /folder

Changed permissions:

chmod -R g+ws /folder

So the group users could read & edit all files within this folder. However when user "moderator" creates a new file it gets following owners:

  • group: city
  • owner: moderator

That means a user "admin" cannot edit that file without sudo. How to force group users to create a file as "admin"?

1 Answer

  1. Evan- Reply


    You already have setgid on the directory, so anything created in it inherits the group ownership. Since Linux ignores setuid on directories, set the umask for the user to make new files group-writable:

    umask 0002

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>