On Tue, 26 May 1998, Niels Hald Pedersen wrote:

> Hi all;
> 
> Maybe this is trivial, but I've not been able to find the answer while
> RTFM:
> 
> How do I assign a program root privileges once for all (as I understand
> it, this is termed to "setuid root" it, or something), so the program
> may be run having such by a mortal user ?
> 
> thanks in advance,
> 
> Niels Hald Pedersen
> [EMAIL PROTECTED]
> 
chmod ug+s program

Provided the program is owned by root (and in the same group). To keep
this on topic geteuid() and getegid() are the functions to use to
determine if the program has been setuid/setgid root. For example,

/* Just an example, YMMV */
if (geteuid()) {
    printf("You must run this as root, or have this program setuid root.\n");
    exit(-1);
}

The Wildman
Gravity is a myth, the earth sucks.
Fight spam - http://www.cauce.org/


Reply via email to