I have a problem with /home folder as root. Here is my script:
home = os.path.expanduser("~")
print home # home is good: /home/guillaume
# gksudo
euid = os.geteuid()
if euid != 0:
print "Running sudo.."
args = ['gksudo', sys.executable] + sys.argv + [os.environ]
os.execlpe('gksudo', *args)
print home # home has changed: /root
How can I get the good /home after gksudo has run ? Thanks
Edit: I've tried
subprocess.call(['gksudo', 'script.py'])
The script is launched, but the operations inside the script are not in root