Best way to gain root privileges

GSO gsowww at
Thu Feb 17 03:10:55 CET 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 ) {

return 0; // never reached!

But even this is considered to be risky.

More information about the Python-list mailing list