c - Dropping root privileges -
I have a daemon that is started as root (hence it can be tied to low ports). After initialization I want to leave the root privileges for security reasons.
Does anyone indicate a known right code in C who will do this?
I have read the man page, I have seen its various implementations in different applications, and they all are different, and some of them are really complex, this is security-related code, and I actually Do not want to change the same mistakes again, which other people are doing. What I see is a best practice, which is a good, portable library function, which I can use in the knowledge that it must be received properly. Is there such a thing?
For reference: I am starting as root; I need to change to run under a different UID and GID; I need to set up the supplemental group correctly; I do not need to change later in root privileges.
You are looking for this article:
< P> Not sure how to enter the best information without replacing the content of that page ...
Comments
Post a Comment