Skip to content

setuserid.3

Manvendra Bhangui edited this page Jul 5, 2024 · 6 revisions

NAME

setuserid - set user identity

SYNTAX

#include <setuserid.h>

int setuserid(char* user, int supp, char *groups);

DESCRIPTION

setuserid sets the effective user ID, effective group ID of user user using user ID, group ID from the passwd(5) database. It uses setuid(2) to set the effective user ID, setgid(2) to set the effective gorup ID. If supp is non zero, setgroups(2) is used to set supplementary groups IDs from group(5) database. setuserid uses getpwnam(3), getgrent(3) to fetch information form the passwd(5) and group(5) database. If QPWGR environment variable is set, setuserid uses qgetpwnam(3), qgetgrent(3) instead.

Additional supplementary groups can be specified as a comma separated null terminated string of group IDs. The group IDS in groups can either be numeric or group IDs from /etc/group.

setuserid returns -1 on failure, 0 on success

SEE ALSO

setuid(2) setgid(2) setgroups(2) getpwnam(3) qgetpwnam(3), qgetpwuid(3), qgetpwnam_r(3) qgetpwuid_r(3), qgetgrnam(3), qgetgrgid(3), qgetgrnam_r(3), qgetgrgid_r(3), qgetpwent(3), qsetpwent(3), qendpwent(3), getgrent(3) qgetgrent(3), qsetgrent(3), qendgrent(3), grpscan(3), setuser_privileges(3),

Clone this wiki locally