Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 9 Feb 2008 12:44:05 +0200
From:      Jonathan McKeown <jonathan+freebsd-questions@hst.org.za>
To:        freebsd-questions@freebsd.org
Subject:   mv, cp, and sgid on directories (was: cp -p)
Message-ID:  <200802091244.05538.jonathan%2Bfreebsd-questions@hst.org.za>

next in thread | raw e-mail | index | archive | help
I think you may be getting too deep into the detail.

Think of the bigger picture:

when I move a file, I don't expect that to change its ownership or 
permissions - it would surprise me if it did;

when I make a copy of a file, I expect to own the copy - after all, what use 
is a private copy I can't do anything with?

FreeBSD generally tries hard not to behave in a surprising way.

The bit that still worries me in this discussion is the sgid bit (pun not 
intended, but I'm not going to delete it now!): as I understand it, creating 
a file has different behaviour on SYSV-derived systems and Berkeley-derived 
systems.

SYSV creates files group-owned by the creator's primary group.
BSD creates files which inherit the group-ownership of the directory they are 
created in.

SYSV behaviour can be changed to BSD behaviour per-directory, by using the 
sgid bit on the directory.
BSD behaviour can't be changed and the sgid bit on a directory is ignored.

Again, could someone confirm whether I'm talking nonsense here?

Jonathan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200802091244.05538.jonathan%2Bfreebsd-questions>