[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: chmod quiestion



On Fri, Dec 21, 2001 at 02:39:23PM +0800, pahud@pahud.net wrote:
> Providing I have a directory /grpdir and chmod it to 775. If a user of
> that group creates a subdirectory under it, say /grpdir/subdir, the subdir
> will have 755 as it's default mode.
> 
> How to force the files and subdirectories under /grpdir to have the same
> chmod value and user.group value?

You can't.

`chmod g+s dirname` will set the sgid bit on the directory, causing
all files created within it to be owned by the same group as the
directory.  You can't force the owning user.

The permissions on created files is determined, as another poster has
mentioned, by the user's umask.  This is, however, a user-controlled
setting.  As the sysadmin, you don't have the ability to force a
specific umask setting to be used on all files within a directory.
The best you can do is add the line

umask 002

to all relevant users' .bash_profile (note that Debian places `umask
022` in that file by default).  This will cause everything a user
creates (from within bash) to be group-writable, not just the single
directory, but that should pose minimal problems on a Debian system,
as Debian's default is to set up each user with their own private
group; as long as you don't add anyone to these groups, user-writable
and group-writable are equivalent unless the file is owned by a
different group (as would be the case in a sgid directory).

(I'm pretty sure that all of this is correct, but if I'm wrong, and
there is a way to force this, I would be overjoyed to learn of it...)

-- 
When we reduce our own liberties to stop terrorism, the terrorists
have already won. - reverius

Innocence is no protection when governments go bad. - Tom Swiss



Reply to: