Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- euid = os.geteuid()
- if euid != 0:
- print "Script not started as root. Running sudo.."
- args = ['sudo', sys.executable] + sys.argv + [os.environ]
- # the next line replaces the currently-running process with the sudo
- os.execlpe('sudo', *args)
- print 'Running. Your euid is', euid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement