I have a program which runs a bunch of tasks as root at launch. After that it needs to drop to a different user. How can that be done?
And just wondering, is it possible to reacquire root without relaunching the program?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The short answer is to use the
setuid()function.It is not possible to reacquire root privileges after switching to a non-root user.