suid doesn't work

Loki Jorgenson Rm421 loki at physicsa.mcgill.ca
Tue Jan 24 12:09:26 AEST 1989


On and off I have tried to get the suid bit of the file mode to function
properly.  Typically, this has meant that I have set a root owned sh or
csh script file with the mode 4755 and tried to execute it as user.  I am
aware of the limitations of using such a file from a NFS mounted partition
but this doesn't work even on the server.

Before anyone suggests it, I have specified the suid mount option on the
partition and remounted it. (By the by, it's a 3/180 running OS 3.5).  Am
I missing something critical here?

Loki Jorgenson			node:  loki at physicsa.mcgill.ca
Physics, McGill University	fax:   (514) 398-3733
Montreal Quebec CANADA		phone: (514) 398-6531

[[ From your message I gather that you are trying to make a shell script
run as a set-uid program.  There are two ways in which a script gets
"executed".  First, the shell checks to see if the system call "exec" can
successfully execute it.  If it cannot, then the shell starts up a
sub-shell with the file as standard input.  With this method, it is
impossible to have a script set-uid.  However, there is the second method.
If the text file starts with the two characters "#!", then the *kernel*
takes the remainder of the line to be the name of an interpretive program
(it also allows one argument to be passed---see the manual page for
"execve(2)").  So if the first line in a shell file is "#!/bin/sh" or
"#!/bin/csh", then the file can actually be executed like it was a binary
executable (it will run when invoked with a call to "exec").  Only this
second form can be successfully set-uid.  --wnl ]]



More information about the Comp.sys.sun mailing list