I'm struggling with the SGID command.

Given the following situation:

----rws--- 1 simon simon 233 nov 24 13:52 hosts

Why can't a user open/edit this file?

  • What is the name of the user opening this file? – Anthon Nov 24 '13 at 14:25
  • Normally, a group named after a user (simon in your case) will only contain that user by default. Are you sure the user opening this file is in the simon group? – Joseph R. Nov 24 '13 at 14:28
  • @Anthon: alice, she isn't in the simon group. – user52999 Nov 24 '13 at 14:32
  • @JosephR.: I would like to open/edit the file without being part of the simon group hence why I chose for SGID. – user52999 Nov 24 '13 at 14:32

The SGID bit will not help you edit a file if you don't belong to the group owning it. The SGID bit on files is mainly useful for running a script with the file's group as your EGID (effective group ID).

To open the file, you still need read permissions to it (i.e. either it should be world-readable or you should be a member of its owning group). Similarly, to edit it, you need write permissions to it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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