Best way to gain root privileges

GSO gsowww at yahoo.co.uk
Wed Feb 16 21:10:55 EST 2011


> pretty much better off with sudo, or a tiny C wrapper that's so simple
> it's hard to get wrong.  However, perl's taint feature would be useful

This snippet is about as tiny as it gets in C I think:

#include <unistd.h>

int main (int argc, char ** argv) {
int err;

char *newenv[] = { NULL };

if ((err = execle("/usr/bin/pauseme", "pauseme", NULL, newenv)) < 0 ) {
	exit(err);
	}

return 0; // never reached!
}

http://linuxgazette.net/67/tag/20.html

But even this is considered to be risky.



More information about the Python-list mailing list