Change environment after setreuid



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'
command?

I could use it (the 'su' command) to start the new process but I'd like
to avoid external dependencies like that.

Thank you
--
Mitko Haralanov
==========================================
The program isn't debugged until the last user is dead.
.



Relevant Pages

  • Re: system(), popen(), and SIGCHLD
    ... >which need to be added to each command line, ... termination of the child created by systemhave all completed by the ... command executed by that shell. ... and should be affected by signals. ...
    (comp.unix.programmer)
  • Re: Performance problem on import
    ... I am attempting to do a mass import of data to this database using a C++ program and the ... mutiple insert commands on both child tables ... until I get to about 50 or so entries in the master table. ... I see delays of 2 or 3 seconds on every insert command. ...
    (microsoft.public.access.externaldata)
  • Re: Is sentience an emergent brain behavior?
    ... The behaviours we produce are initially function of our ... the environment. ... sleepiness to see if the child was ready for bed. ... painterly technique - his parents were sooo worried ...
    (comp.ai.philosophy)
  • Re: Understanding strategies for establishing relations
    ... environment, rather then to establish the fixed relations in the database, ... In the Form Designer's dataenvironment window, ... and) use Views for the child aliases. ... browse through parent data, ...
    (microsoft.public.fox.programmer.exchange)
  • Re: difference between a spawn and a fork
    ... command in a child processes. ... would do a fork() followed by an exec*in the child. ... process based on the parent, and most of that work is useless ...
    (comp.unix.programmer)