Hello list.

I have a question about the following observed behavior.

Let's assume that a user (user_a) belongs to two groups (group_a and
group_b.)
The user creates a directory called "testdir" and the ownership permissions
are
user_a:group_a after the directory is made.  The user runs:

chown user_a:group_b testdir

to change the group ownership to the user's secondary
group.  When the user changes to the new directory and creates a new file
with

touch test

the new file is created with the following ownership permissions:

user_a:group_b

On most of the unix / unix-like systems I support, this behavior would be
different.  The file would be created with user_a:group_a (since group_a is
the primary group.)  This is true on AIX, Solaris, Linux, and HP-UX per my
testing earlier today.  On Tru64 and OpenBSD, the group ownership seems
to be inherited by the parent directory rather than set by the user's
primary group
membership.  For AIX et.al. the "setgid" bit on the parent directory would
change
the behavior such that files created inside that directory would be owned by
the
parent directory group owner regardless of user's primary group membership.

It appears that OpenBSD (and Tru64) treat the directory as setgid (when
compared to the other OSes) but it is not.

My question is, is this the expected behavior, and what was the reasoning
when deciding to implement it this way if it is (expected behavior?)  Also,
is
there a known way to change this behavior to match the default behavior of
AIX and friends?

Testing of OpenBSD behavior was performed on version 4.8 running on alpha
and 4.9 running in qemu emulating i386.  Testing was done on mount points
with no options running other than "rw" as well as mounts with "nodev" and
"nosuid" options set.

I know this is a small thing, and comparing OpenBSD to the other systems
is kind of moot, I only bring this up because I'm trying to grasp the
reasoning
for this behavior.

Thank you for any responses,
Stefan Johnson

Reply via email to