setuser() - change effective and real uid and gid of process
#include <interix/security.h>
int setuser(char *username, char *password, int flags)
The setuser(2) function changes the effective and real uid and gid of the current process to that of the specified username. All of the security attributes and permissions become those of username. However, the process' current working directory does not change.
The setuser(2) function takes the following arguments:
There can be a performance degradation if a process changes identity to a user who does not have permission to be located in the current working directory. The best solution is, after a call to setuser(2), to chdir(2) to a directory known to be permitted for the new identity.
You must have the right to log on interactively on a domain controller for someone to call setuser(2) for you. An administrator, however, can call setuser(2) for you even if you do not have the right to log on interactively to a domain controller. If the administrator calls setuser(2) for you, he or she is not required to use your password.
On success, the setuser(2) function returns 0. On failure, it returns -1 and sets errno.
The setuser(2) function can fail for the following reasons:
This function replaces authenticateuser(2). In fact, the version of authenticateuser(2) in this release is a wrapper around setuser(2).
setuid(2)
setgid(2)
exec_asuser(2)