Raghul wrote:
Hi
   Is it possible to login as a root in linux using python script?
What I need is when I execute a script it should login as root and
execute my command and logout from root to my existing account. IS is
possible?

Thanx in advance.

Hi,

 You can compile the small .c program and setuid it's executable.
 Change the path to your .py script of course.


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

int main(int argc,char **argv)
{
        char *c1[]={"/tmp/Chg.py\0",'\0'};

        setuid(0);
        seteuid(0);
        execv(c1[0],c1);
        return 1;
}
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to