Retaining file permissions

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

Submitted-by: karish at (Chuck Karish)

In article <18296 at> alex at (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, 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

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

Volume-Number: Volume 22, Number 140

More information about the Comp.std.unix mailing list