Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've a question regarding setting setgid bit on directories. According to this page:
Quote:
The setgid bit, 's' or 'S' if there is no corresponding group 'x' bit, influences the creation of new files in the directory. New files are created with their group ID set to that of the directory; the same is true of new directories but in addition they have the setgid bit set. (Not all systems do this.)
The point of this is to make working with groups easier. If all the files created in a group's working directory automatically have the right group ID then other members of the group will be able to access them provided they are created with the right permission bits. The latter can be fixed manually, but it is more convenient to set each user's umask to 002 or 007 (to make all new files group writable). Each user needs to have their own private group, sharing name and number with their user ID, to avoid having to constantly change umask (or leaving all their private files accessible to whatever their default group is).
Could somebody explain me the meaning of text in bold? What does a user's primary group have to do with umask builtin?
Whenever a directory has SGID set on it, any new file or subdirectory created within it will inherit the group of the parant directory. And only those users will be allowed to access the directory or create new files/directory inside it, who are member of the main group of the directory.
So, those users should have umask set in such a fashion that any new file/dir. created by them should get write permission for group, so other group members can also access or modify the file/dir. created by that user.
And just to elaborate further, if users did not each have a private group (as in old versions of UNIX where all users had "users" as their primary group), then having a umask that allowed group read and write permission would mean that all users could read and write your private files. You would, for privacy, have to keep a umask that disallowed group access and change your umask whenever you were working in a directory that was intentionally shared by a group. That's not a practical solution.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.