how to control create permissions in a dir?

Robert Locke lists at ralii.com
Wed Oct 26 12:58:10 UTC 2005


On Tue, 2005-10-25 at 19:30 -0400, Shockwave wrote:
> On Tue, 2005-10-25 at 15:46 -0700, Craig White wrote:
> > On Tue, 2005-10-25 at 15:58 -0500, Christopher J. Bottaro wrote:
> > > tlc wrote:
> > > 
> > > > On Tue, 2005-10-25 at 14:19 -0500, Christopher J. Bottaro wrote:
> > > >> I have a dir /home/music which is shared by all my users.  I want every
> > > >> file created under /home/music to have 666 permissions, no matter who
> > > >> creates it, and every dir created under /home/music to have 777
> > > >> permissions, no
> > > >> matter who creates it.  How do I do this?
> > > >> 
> > > >> Thank you for the help.
> > > >> 
> > > > are these going to be local users or samba users? If they are smb users
> > > > you can set that up in the conf file.
> > > 
> > > Local users, not samba users.
> > ----
> > I know of no way to get this done without changing basic behavior.
> > 
> > You could change the default umask for all the users, default umask is
> > 022 which strips the write permission on the files that they save. This
> > isn't recommended procedure since that means that everyone always writes
> > files that everyone else can read. If you want to travel down this path,
> > it's likely bash shell and /etc/bashrc sets it but I wouldn't go there.
> > 
> 
> Why not just make all of the users part of the same group?  I checked my
> FC3 system and as a non-root user, I have a umask setting of 002 which
> means I create directories that are "rwx" and files that are "rw" with
> respect to everyone in the same group as me.  This should work just
> fine.  Even if the umask settings are currently 022 on the system in
> question, they could be changed to 002 and not sacrifice much with
> respect to security.
> 

Go a step further and "chgrp commongroup /home/music ; chmod
2770 /home/music" and the files created in that directory will have the
group of "commongroup" assigned when they are created rather than the
user's default primary group.  BTW, the umask is set to 0002 if the
user's name and primary group name are the same when the user logs in
and the user's UID is above some threshold, otherwise it is set to 0022.
This goes back to the whole User Private Group scheme that Red Hat has
adopted, but segues nicely for doing collaboration with the SGID bit set
on a directory.

--Rob




More information about the fedora-list mailing list