Make newly created directories 0775 by default

Matthew Saltzman mjs at CLEMSON.EDU
Sat Feb 2 22:57:21 UTC 2008

On Sat, 2008-02-02 at 16:46 -0500, Garry T. Williams wrote:
> On Saturday 02 February 2008 15:04:16 Excalibur Xcalibur wrote:
> > Hi all,
> >           Presently when somebody creates a directory, it's 0755.
> >  i.e. not writable by the group. I have a file server and would like
> >  to change this default property such that when somebody created a
> >  directory it's 0775. i.e.  writable by the group. For my file
> >  server, this is a must as users of the same group need to be able
> >  to edit each others folders. Thanks.
> The file server or file system does not supply the information you
> want defaulted.  Each user supplies the modification mask for a new
> file or directory.
> A user can set a default for the modification mask on his files and
> directories, though.  This is called the umask.  This command will set
> the umask for the current process (shell) to the default you want:
>     umask 002
> You could request users to set this in their login scripts or you
> could even set it for them by modifying /etc/profile and/or other
> files run by various shells.

For bash, this snippet is in /etc/bashrc:

        if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
                umask 002
                umask 022
So if it's not a system account and the userid and group id are the same
(as is usual on first login for normal users), umask is already 002.

In the "user private group" scheme that Red Hat uses, you would create a
separate project group and set the project directory's setgid bit so
that files created there inherit the directory's group.  If a user is a
member of the project group then he can log in with his usual private
group (and get umask 002) and any file he creates in the project
directory will get the project groupid and be group writable.

> But, in the end, the user controls this.

The above applies as long as the user includes /etc/bashrc in .bashrc
doesn't override the default set there.

A similar snippet is in /etc/csh.cshrc.


                Matthew Saltzman

Clemson University Mathematical Sciences
mjs AT clemson DOT edu

More information about the fedora-list mailing list