credentials
DESCRIPTION
Process ID (PID)
Each process has a unique non-negative integer identifier that is
assigned when the process is created using fork(2). A process can
obtain its PID using getpid(2). A PID is represented using the type
pid_t (defined in <sys/types.h>).
PIDs are used in a range of system calls to identify the process
affected by the call, for example: kill(2), ptrace(2), setpriority(2)
setpgid(2), setsid(2), sigqueue(2), and waitpid(2).
A process's PID is preserved across an execve(2).
Parent Process ID (PPID)
A process's parent process ID identifies the process that created this
process using fork(2). A process can obtain its PPID using getppid(2).
A PPID is represented using the type pid_t.
A process's PPID is preserved across an execve(2).
Process Group ID and Session ID
Each process has a session ID and a process group ID, both represented
using the type pid_t. A process can obtain its session ID using get-
sid(2), and its process group ID using getpgrp(2).
A child created by fork(2) inherits its parent's session ID and process
group ID. A process's session ID and process group ID are preserved
across an execve(2).
Sessions and process groups are abstractions devised to support shell
job control. A process group (sometimes called a "job") is a collec-
tion of processes that share the same process group ID; the shell cre-
ates a new process group for the process(es) used to execute single
command or pipeline (e.g., the two processes created to execute the
command "ls | wc" are placed in the same process group). A process's
group membership can be set using setpgid(2). The process whose pro-
cess ID is the same as its process group ID is the process group leader
for that group.
A session is a collection of processes that share the same session ID.
All of the members of a process group also have the same session ID
(i.e., all of the members of a process group always belong to the same
session, so that sessions and process groups form a strict two-level
hierarchy of processes.) A new session is created when a process calls
setsid(2), which creates a new session whose session ID is the same as
the PID of the process that called setsid(2). The creator of the ses-
sion is called the session leader.
User and Group Identifiers
Each process has various associated user and groups IDs. These IDs are
integers, respectively represented using the types uid_t and gid_t
(defined in <sys/types.h>).
effective user (group) ID using geteuid(2) (getegid(2)).
* Saved set-user-ID and saved set-group-ID. These IDs are used in
set-user-ID and set-group-ID programs to save a copy of the corre-
sponding effective IDs that were set when the program was executed
(see execve(2)). A set-user-ID program can assume and drop privi-
leges by switching its effective user ID back and forth between the
values in its real user ID and saved set-user-ID. This switching is
done via calls to seteuid(2), setreuid(2), or setresuid(2). A set-
group-ID program performs the analogous tasks using setegid(2),
setregid(2), or setresgid(2). A process can obtain its saved set-
user-ID (set-group-ID) using getresuid(2) (getresgid(2)).
* File system user ID and file system group ID (Linux-specific).
These IDs, in conjunction with the supplementary group IDs described
below, are used to determine permissions for accessing files; see
path_resolution(7) for details. Whenever a process's effective user
(group) ID is changed, the kernel also automatically changes the
file system user (group) ID to the same value. Consequently, the
file system IDs normally have the same values as the corresponding
effective ID, and the semantics for file-permission checks are thus
the same on Linux as on other Unix systems. The file system IDs can
be made to differ from the effective IDs by calling setfsuid(2) and
setfsgid(2).
* Supplementary group IDs. This is a set of additional group IDs that
are used for permission checks when accessing files and other shared
resources. On Linux kernels before 2.6.4, a process can be a member
of up to 32 supplementary groups; since kernel 2.6.4, a process can
be a member of up to 65536 supplementary groups. A process can
obtain its set of supplementary group IDs using getgroups(2), and
can modify the set using setgroups(2).
A child process created by fork(2) inherits copies of its parent's user
and groups IDs. During an execve(2), a process's real user and group
ID and supplementary group IDs are preserved; the effective and saved
set IDs may be changed, as described in execve(2).
Aside from the purposes noted above, a process's user IDs are also
employed in a number of other contexts:
* when determining the permissions for sending signals -- see kill(2);
* when determining the permissions for setting process-scheduling
parameters (nice value, real time scheduling policy and priority,
CPU affinity, I/O priority) using setpriority(2), sched_setaffin-
ity(2), sched_setscheduler(2), sched_setparam(2), and ioprio_set(2);
* when checking resource limits; see getrlimit(2);
* when checking the limit on the number of inotify instances that the
process may create; see inotify(7).
CONFORMING TO
groups(3), tcgetpgrp(3), tcsetpgrp(3), capabilities(7), path_resolu-
tion(7), unix(7)
COLOPHON
This page is part of release 2.77 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2007-06-13 CREDENTIALS(7)
Man Pages Copyright Respective Owners. Site Copyright (C) 1993 - 2020
www.LXU.io.
All Rights Reserved.