[plug] setuid etc

Russell Steicke r.steicke at bom.gov.au
Mon Feb 10 16:26:45 WST 2003


On Mon, Feb 10, 2003 at 03:58:44PM +0800, Carl Gherardi wrote:
> 'lo all,
> 
> I'm having a battle with a program at the moment.
> 
> I have a program that looks very much like:
...
> This program makes sure that the actual uid of the program runs as root and
> not just the effective uid.

Do you need this?  From the sudo(8) man page:

       sudo allows a permitted user to execute a command as the superuser or
       another user, as specified in the sudoers file.  The real and effective
       uid and gid are set to match those of the target user as specified in
       the passwd file (the group vector is also initialized when the target

sudo sets uid and effective uid.

$ ./uids
uid=16215
euid=16215
$ sudo ./uids
uid=0
euid=0
$ cat uids.c
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char **argv)
{
        printf("uid=%d\n", getuid());
        printf("euid=%d\n", geteuid());
        return 0;
}





-- 
Russell Steicke

-- Fortune says:
Parkinson's Law:  Work expands to fill the time alloted it.



More information about the plug mailing list