Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Say two people with different primary unix GIDs share and need to frequently edit the same file. The users are not members of each others' primary unix GIDs, but they are both members of a common second group.

The accepted answer (and other posted answers) to this question suggest setting the sticky bit on the file's parent directory so that such a file does not get the user's primary group ID whenever one of the users modifies the file (i.e. they claim it removes the need to call newgrp in every login session whenever one of the users wants to edit the shared file)

However I thought that something like this could only be done with with the setgid bit.

From Wikipedia:

Setting the setgid permission on a directory (chmod g+s) causes new files and subdirectories created within it to inherit its group ID, rather than the primary group ID of the user who created the file (the owner ID is never affected, only the group ID).

Why would the sticky bit help with this?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You're right, it's the setgid bit that has this effect. The sticky bit has an effect on a directory too, but it's unrelated: it means that only the owner of a file can delete it, as opposed to anyone with write permission on the directory (think /tmp).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.