Jump to content

Annoying group permissions problem


Recommended Posts

For a group project that I am doing for school, I have set up a directory under my home and have changed the group for it to the group id that my group is using.

 

However, we are having a problem, for some reason, in some directories under the group one, if someone creates a new file, or modifies an existing file, the owner/group id's are set to:

 

owner - the person who created the file

group - the id of the group.

 

The problem is that for some other directories, if you create, or modify, a file, the owner/group ids are set to the person who last worked on the file.

 

This means we are having to constantly change the group the file belongs to.

 

SO, the question is this:

1. Why the difference in behaviour between the different directories

2. How to make any directory default to the group id

 

Thanks.

Link to comment
Share on other sites

Good question. I don't have the answer. The best I could achieve is this solution (in my case, the directory is /local/share):

- First, for all my users, I set the umask to 002, which is easily done by adding the following line to /etc/profile:

umask 002

. That way, permissions for group and user should be the same.

- Next, now and then, I check that all directories under (and including) /local/share have the s bit, so that files (but not directories...) created under have the same user, group, and permissions:

# chown -R root.share /local/share

# find /local/share -type d -exec chmod 6775 {};

where "share" is the group, all users having access to this place, belong to.

 

Yves.

Link to comment
Share on other sites

Not just sure I understand the problem, but here is a solution.

Set the sgid bit for the top directory (chmod 2xyz, where xyz is the octal version of the current permissions). All the files created in the top directory (meaning any file in a directory in a directory in a .... in the top directory) will have the group id set to the group id of the top directory.

 

baudolino

sgid guru

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...