suid() and root

Guy Harris guy at sun.uucp
Sat Apr 13 14:08:35 AEST 1985


> It seems that under my "System III" Xenix system, the suid() call doesn't
> work if the user is already root. Is this normal? Proper? 

Do you mean the set-UID bit, or the "setuid()" system call?  If the former,
"setuid()" had better work if the user is root. If the latter, then no,
it is neither normal nor proper.  Standard System III (and System V, and
also 4.2BSD) honor the set-UID bit even if the process is running as
"root"; this was probably done for the very reason you mention - that
many set-UID programs want to run with the specified UID even if by
"root" happens to run them.  Microsoft may have taken a V7 system and
converted it into a System III system (which isn't too hard; no, they are
NOT radically different versions of UNIX!), but missed the change to
the handling of set-UID (when we did our System III UNIX at CCI, we did
it the same way, and missed the set-UID change; I stuck it in later).

> Is there any solution other than going back to a non-superuser status
> before running uucico?

Unfortunately, no.  You could write a tiny program which resets the UID
and executes "/usr/lib/uucp/uucico.rl" or somesuch, and move
"/usr/lib/uucp/uucico" to "/usr/lib/uucp/uucico.rl".  The 4.2BSD UUCP,
which was originally the Research Triangle Institute UUCP (i.e., it wasn't
just for 4.2BSD, which *does* handle set-UID properly) set the UID to 
"uucp"s UID if it was run as root, to handle this very problem.

	Guy Harris
	sun!guy



More information about the Net.bugs.usg mailing list