Forum Moderators: bakedjake
setuid and setgid are used for setting the user-id and the group-id (respectively) of a file. The user-id determines who owns the file and group-id determeins what group of people can access the file.
Without knowing more of what you are asking I don't want to launch into a discussion of *nix file permissions and the details of setting uid/gid.
ie
a file owned by root that is set setuid will run as root even if a normal user runs it.
Be very careful using this. Shell scripts generally don't work setuid, the shell knows how bad they are ;)
Sean
I didn't want my roommate getting 'root' on the box, since we were always trying to break each others' boxes, so I kept that one in particular with a really weird password, and I'd tell him that that box was not to be touched, since it "did some very important stuff", just to get him interested. Even though all it did was seti@home "stuff". ;)
Except every time I needed to access it, I'd forget the stupid password. So, I finally got sick of booting from the CD and resetting my root password, so I wrote a nice little C program that did setuid(), and opened a new shell for me. Everytime I forgot the password, I'd log in as my normal user, and just run that program, and reset the root password.
This was before I found out about ssh keys, and that making my life a little easier with forgotten passwords. (one key, stored as an obscure file that I would use if I forgot the password).
Not terribly smart, but it was fun. :)
Weird story, I know, but I thought I'd share. ;)
-MM