Question about the difference of with and without SGID on directory

Matthew Seaman m.seaman at infracaninophile.co.uk
Thu May 31 18:41:02 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Patrick Dung wrote:
> Hi
> 
> I found Free/Net/OpenBSD semantic is different from Linux/Solaris.
> 
> Suppose there is a directory called 'directory,
> With owner www, and group www and permission 0777.
> 
> Then I touch a file:
> $ touch file
> $ ls -la
> total 4
> drwxrwxrwx  2 www   www    512 May 31 17:14 .
> drwxrwxrwt  8 root  wheel  512 May 31 17:14 ..
> -rw-r--r--  1 patrick   www      0 May 31 17:14 file
>                         ^^^
> The file created will have a group owner of the owner of the directory
> not the creator.
> 
> So I have two questions here:
> 1. So is there a difference with SGID on directory?

No.  BSDish behaviour of a directory with either mode drwxr-xr-x
or drwxr-sr-x is essentially identical to SysV/Linux-ish behaviour
with a directory mode drwxr-sr-x

> 2. Any idea about why it is different from SYSV (Linux/Solaris)?

It's historic.  BSD has always worked that way and SysV has begged
to differ.

	Cheers,

	Matthew

- --
Dr Matthew J Seaman MA, D.Phil.                       Flat 3
                                                      7 Priory Courtyard
PGP: http://www.infracaninophile.co.uk/pgpkey         Ramsgate
                                                      Kent, CT11 9PW, UK
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.3 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGXxaf3jDkPpsZ+VYRA+RtAJ90NGhTKUxHIY79zGIMdyYq0mzJjgCgjLKf
4t1RvGp9AyaUWLohlA52Qxc=
=XJEv
-----END PGP SIGNATURE-----


More information about the freebsd-questions mailing list