setuid bit and unix scripts

Yohhan

Limp Gawd
Joined
May 17, 2002
Messages
220
Does the setuid bit not work for shell scripts?

I need a script to execute with the priviledges of the owner. So I use the setuid bit. However, this doesn't seem to work. I set the permissions exactly as they're set on the passwd program, but the script won't run under those permissions... it's running under the "other" set of permissions instead of with the permissions of the owner. Almost like the setuid bit did nothing at all.

Does this has something to do with the fact that scripts are executed under subshells? When I capture a list of the running processes, passwd shows the UID of root, while my script shows my own UID.
 
I ran into this problem as well, and as near as I can figure, the setuid bit has no effect on scripts.

This was on RH 8 at the time, but I've since been told that it's the same on most linux distros. That leads me to believe that it's a kernel option somewhere, but I really don't know. Maybe it's just really a bad idea, so much so that most distros disable it by default.

*shrug*
 
Back
Top