Change environment after setreuid

M

Mitko Haralanov

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top