Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 5
    You can force the group ownership with the setgid bit on directories, but it works only for the group, not for the user. So the question becomes: why do you want to change user ownership, too, and what do you hope to achieve by that? Commented Feb 16, 2017 at 10:08
  • I want the user to be able to read/view the file. When a file is being created it is being user-owned by 'superadmin' with permission rwx Basically all I want is, the files to inherit the same user and groups and same permissions and ownerships as of the parent directory Commented Feb 16, 2017 at 10:17
  • 2
    You could swap user and group to achieve this: Create a group prateekkaien (or use an existing one), use setgid as described by @dirkt, set the permissions accordingly and leave the user untouched. Commented Feb 16, 2017 at 10:21
  • As a further example, you normally just make groups according to the necessary roles, and then assign users to it. For example, my /usr/local as a setgid of staff, and I'm member of staff, so I can work with files below /usr/local any way I want. If some other user who is also a member of staff does the same, I don't care, because as a member of the same group, I can modify his files etc. Commented Feb 16, 2017 at 10:27
  • By this, will not the user 'prateekkaien' gain access of rwx as of the group ? The superuser is the administrator. It can create and modify files but the user can only view/read it. I didnt get what it says above Commented Feb 16, 2017 at 10:36