Luis Bruno wrote:
Raghul wrote:
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.
I'm not sure of what you need, so I'll assume your *whole* .py script
needs root priviledges. In this case, you can configure sudo(8) or use
su(1).
For example, the script below does nothing special:
| #!/usr/bin/env python
|
| print "Hello world!"
You can run it with higher priviledges if you use sudo(8):
$ chmod 755 hello.py
$ sudo ./hello.py
Or you can use su(1):
$ su - root -c ./hello.py
You can configure sudo(8) to not prompt for any password, BTW.
Cheers!
another alternative would be setuid for more on this (and why it could
be a bad idea) google...
Martin
--
http://mail.python.org/mailman/listinfo/python-list