LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-02-2013, 11:56 AM   #1
moraxu
LQ Newbie
 
Registered: Dec 2012
Distribution: Ubuntu
Posts: 15

Rep: Reputation: Disabled
Setgid bit on a directory


Hi,

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?
 
Old 04-02-2013, 12:18 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
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.
 
Old 04-02-2013, 04:27 PM   #3
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,776

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Sticky bit directory Spruce_Moose Linux - Newbie 9 03-20-2013 05:23 AM
automake, makefile.am, binary directory, both 32 bit and 64 bit executables? MrUmunhum Linux - Kernel 0 12-26-2011 04:47 PM
Always set group write bit in given directory? jnojr Linux - Newbie 3 05-07-2009 07:29 PM
setting up stick bit on file/directory bavondrake AIX 3 09-20-2007 02:27 PM
setuid + setgid files... jd32 Linux - Security 2 10-16-2004 11:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:57 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration