A program wants to do some activities with root privileges when it starts up and shuts down. Other activities it does can be done as a lesser privileged user. Which of the options given below is most secure?
The program should be started with root privileges. Then it should use setuid(UID) to change privileges between root and another account.
The program should be started with root privileges. Then it should use seteuid(UID) to change privileges between root and another account.
Starting the program as root is a security risk. The program should run with least privileges and obtain root using seteuid(UID) whenever necessary.
The program has to run with root privileges entirely. Once root privileges are dropped they cannot be regained.