Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setuid(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec: execl, execv, execle, execve, execlp, execvp

getpid, getpgrp, getppid

getuid, geteuid, getgid, getegid

run: runl, runv, runle, runve, runlp, runvp

rexec



SETUID(2,L)                 AIX Technical Reference                 SETUID(2,L)



-------------------------------------------------------------------------------
setuid, setgid



PURPOSE

Sets a process's user and group IDs.

SYNTAX

#include <sys/types.h>




                int setuid (uid)            int setgid (gid)
                uid_t uid;                  gid_t gid;



DESCRIPTION

The setuid system call sets the real user ID, the effective user ID, and the
saved-set-user ID of the calling process.  If the effective user ID of the
calling process is superuser, then the real user ID, effective user ID, and the
saved-set-user ID are set to the value of the uid parameter.  If the effective
user ID of the calling process is not superuser, but the real user ID or the
saved-set-user ID is equal to the value of the uid parameter, then the
effective user ID is set to the value of the uid parameter.

The setgid system call sets the real group ID, the effective group ID, and the
saved-set-group ID of the calling process.  If the effective user ID of the
calling process is superuser, then the real group ID, effective group ID, and
the saved-set-group ID are set to the value of the gid parameter.  If the
effective user ID of the calling process is not superuser, but the real group
ID or the saved-set-group ID is equal to the value of the gid parameter, then
the effective group ID is set to the value of the gid parameter.

RETURN VALUE

Upon successful completion, a value of 0 is returned.  If the setuid or setgid
system call fails, then a value of -1 is returned and errno is set to indicate
the error.

ERROR CONDITIONS

The setuid and setgid system calls fail if the following is true:

EPERM   The uid (gid) parameter is not equal to the real user (group) ID of the
        process or to the saved-set-user (group) ID as set by the exec system
        call, and the effective user ID is not superuser.



Processed November 7, 1990        SETUID(2,L)                                 1





SETUID(2,L)                 AIX Technical Reference                 SETUID(2,L)




EINVAL  The uid (gid) parameter is not a valid user (group) ID.

RELATED INFORMATION

In this book:  "exec:  execl, execv, execle, execve, execlp, execvp," "getpid,
getpgrp, getppid," "getuid, geteuid, getgid, getegid," "run: runl, runv, runle,
runve, runlp, runvp," and  "rexec."















































Processed November 7, 1990        SETUID(2,L)                                 2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026