While in a C program(say being executed as user A) due to security issues, I have to execute a certain set of commands as a different OS user ( say user B ). The way I am trying to do is with the system command
something like system("sudo -u userB cmd");
But there are 2 un desirable side effects to this
1, A has to be sudoer
2, Having to enable passwordless sudo execution for A ( my admin is not happy with this ).
Could any one please suggest any other effect way? ( with out use of sudo possibly.)
Also can be done using setuid() calls?