Retaining file permissions

Chuck Karish karish at mindcraft.com
Wed Mar 6 09:46:58 AEST 1991


Submitted-by: karish at mindcraft.com (Chuck Karish)

In article <18296 at cs.utexas.edu> alex at am.sublink.org (Alex Martelli) writes:
>So, what DOES Posix say about this (open(), write(),
>cat, shell redirection, and permission bits), and what SHOULD it say?

POSIX.1 clause 5.6.1.2, descriptions of S_ISUID and S_ISGID bits:  "On
a regular file, this bit should be cleared on any write."

Note the word "should".  This is a recommendation to implementors, not
a requirement.

BSD 4.3 write(2) man page: "If the real user is not the super-user,
then write() clears the set-user-id bit on a file."

Interactive man pages for stat(2), write(2), and chmod(2) are silent on
this issue.

POSIX.2 is pretty much constrained to accept as valid behavior that's
allowed/suggested by POSIX.1.  I don't think there are any requirements
that the utilities second-guess and defeat the file access policies
that could legitimately be imposed by an underlying POSIX.1 operating
system.

	Chuck Karish		karish at mindcraft.com
	Mindcraft, Inc.		(415) 323-9000

Volume-Number: Volume 22, Number 140



More information about the Comp.std.unix mailing list