A method to change effective user id of a running program?

Posted by Brendan Long on Stack Overflow See other posts from Stack Overflow or by Brendan Long
Published on 2010-03-25T01:26:06Z Indexed on 2010/03/25 1:33 UTC
Read the original article Hit count: 438

Filed under:
|

I'm writing a simple package manager and I'd like to automatically try sudo if the program isn't run as root. I found a function called seteuid, which looks likes it's exactly what I need, but I don't have the permissions to run it. So far all I can think of is a bash script to check before they get to the actual binary, but I'd like to do this all as C++ if possible.

Is there any method of changing a processes's euid after it starts executing? Or a way to call sudo?

© Stack Overflow or respective owner

Related posts about linux

Related posts about c++