Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Loonix halp

Name: Anonymous 2008-01-22 18:24

How would I make my program check if it was root?

Name: Anonymous 2008-01-22 18:53


#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>

int main () {
    if ( geteuid() == 0 )
        printf("You're root!\n");
    else
        printf("You're lower than a maggot!\n");
    return 0;
}


Also, `man 2 geteuid'.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List