How does UNIX determine what group should own the files you create? There are three ways:
On most System V-based systems, the effective group ID of the process determines the ownership of the files you create. (Your effective GID is yourunless you're running a program.)
On most BSD UNIXes, files are owned by the group that owns the directory in which you create the file.
The rules under SunOS 4.x and System V Release 4 are more complicated. The system administrator decides which of the two above methods a filesystem will use for group ownership. There are other wrinkles, too. A good place to look for the gory details is your system's open(2) manpage... but it's probably easier to justand then check the group ownership with .
You may be able to use the directory's set group ID (setgid) bit to control group ownership. In those cases, if the bit is set, the BSD rules apply. if the bit is not set, the System V rules apply. To set and remove the setgid bit, use the commandsand chmod g-s, respectively.
If you've reset directory mode bits, it's possible to
wind up with ls -l permissions that have an uppercase "S",
(It's often a mistake.)
The directory's setgid bit is set, but the execute bit isn't set.
If you want the directory to be group-accessible,
add execute permission with chmod g+x.
Otherwise, you may want to clear the setgid bit with chmod g-s.