Change environment after setreuid
mitko at qlogic.com
Tue Sep 30 20:56:54 CEST 2008
I have a program (which normally runs as root) which can start child
processes as different users.
Effectively, my program is a modified version of popen2's Popen3 class
where the child process (after the fork) does:
os.setregid (gid, gid)
os.setreuid (uid, uid)
session_pid = os.setsid ()
This all seems to work. However, I am running into a problem where the
environment of the new process still carries values that were set
before the setreuid() call.
What would be the best way to go about modifying the environment
without having to re-implement all the functionality of the 'su'
I could use it (the 'su' command) to start the new process but I'd like
to avoid external dependencies like that.
The program isn't debugged until the last user is dead.
More information about the Python-list