[vox-tech] specify umask for a folder?
Mark K. Kim
lugod3MAPS at cbreak.org
Sun Dec 10 17:01:37 PST 2006
On Sun, Dec 10, 2006 at 04:50:56PM -0800, Jonathan Stickel wrote:
> I would like to share a group of folders and files with someone else.
> Our default group is the same. If we both set our umask (e.g. in
> ~/.bashrc) to 002, then any file either of us creates can be modified or
> deleted by the other, or anyone else in our default group. This is the
> behavior I want. However this applies to all files we create anywhere
> in the local filesystem(s). Is there a way to set umask locally to a
> folder and it's subfolders?
First, make sure the default group is different for everyone (ie, same
as their username). That way, any file they create won't be rwx for
everyone, even if their umask is 002. Also, go ahead and do set their
umask to be 002.
In the folder you want everyone to share (ie, /mnt/shared), set the
group to be the shared group for everyone (ie, "shgrp"). Additionally,
set the group's sticky bit on the folder and the subfolders. Like this:
$ find /mnt/shared -exec chgrp shgrp \{\} \;
$ find /mnt/shared -type d -exec chmod g+s \{\} \;
When you create a file in a directory with its group sticky bit set, the
file's default group becomes identical to the directory's group. When
you create a subdirectory in a directory with its group sticky bit set,
the subdirectory's default gropu becomes identical to the directory's
group *and* its group sticky bit gets set as well.
FYI, I noticed winscp ignores the umask and the above "group sticky
rules" when it transfers files from windows to linux.
-Mark
More information about the vox-tech
mailing list