{
    "mode": "man",
    "parameter": "CREDENTIALS",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/man/CREDENTIALS/json",
    "generated": "2026-10-22T12:44:16Z",
    "sections": {
        "NAME": {
            "content": "credentials - process identifiers\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "",
            "subsections": [
                {
                    "name": "Process ID (PID)",
                    "content": "Each process has a unique nonnegative integer identifier that is assigned when the process is\ncreated  using  fork(2).  A process can obtain its PID using getpid(2).  A PID is represented\nusing the type pidt (defined in <sys/types.h>).\n\nPIDs are used in a range of system calls to identify the process affected by  the  call,  for\nexample:  kill(2),  ptrace(2),  setpriority(2), setpgid(2), setsid(2), sigqueue(3), and wait‐\npid(2).\n\nA process's PID is preserved across an execve(2).\n"
                },
                {
                    "name": "Parent process ID (PPID)",
                    "content": "A process's parent process ID identifies the process that created this process using fork(2).\nA process can obtain its PPID using getppid(2).  A PPID is represented using the type pidt.\n\nA process's PPID is preserved across an execve(2).\n"
                },
                {
                    "name": "Process group ID and session ID",
                    "content": "Each process has a session ID and a process group ID, both represented using the type  pidt.\nA  process  can  obtain  its session ID using getsid(2), and its process group ID using getp‐\ngrp(2).\n\nA child created by fork(2) inherits  its  parent's  session  ID  and  process  group  ID.   A\nprocess's session ID and process group ID are preserved across an execve(2).\n\nSessions and process groups are abstractions devised to support shell job control.  A process\ngroup  (sometimes  called  a  \"job\") is a collection of processes that share the same process\ngroup ID; the shell creates a new process group for the process(es) used  to  execute  single\ncommand  or  pipeline  (e.g.,  the two processes created to execute the command \"ls | wc\" are\nplaced in the same process group).  A process's group membership can be set using setpgid(2).\nThe process whose process ID is the same as its process group ID is the process group  leader\nfor that group.\n\nA session is a collection of processes that share the same session ID.  All of the members of\na  process  group  also have the same session ID (i.e., all of the members of a process group\nalways belong to the same session, so that sessions and process groups  form  a  strict  two-\nlevel  hierarchy  of  processes.)   A  new session is created when a process calls setsid(2),\nwhich creates a new session whose session ID is the same as  the  PID  of  the  process  that\ncalled setsid(2).  The creator of the session is called the session leader.\n\nAll  of the processes in a session share a controlling terminal.  The controlling terminal is\nestablished when the session leader first opens a terminal (unless the ONOCTTY flag is spec‐\nified when calling open(2)).  A terminal may be the controlling terminal of at most one  ses‐\nsion.\n\nAt most one of the jobs in a session may be the foreground job; other jobs in the session are\nbackground  jobs.   Only the foreground job may read from the terminal; when a process in the\nbackground attempts to read from the terminal, its process group is sent  a  SIGTTIN  signal,\nwhich  suspends  the job.  If the TOSTOP flag has been set for the terminal (see termios(3)),\nthen only the foreground job may write to the terminal; writes from background jobs  cause  a\nSIGTTOU  signal  to be generated, which suspends the job.  When terminal keys that generate a\nsignal (such as the interrupt key, normally control-C) are pressed, the signal is sent to the\nprocesses in the foreground job.\n\nVarious system calls and library functions may operate on all members of a process group, in‐\ncluding kill(2), killpg(3),  getpriority(2),  setpriority(2),  ioprioget(2),  ioprioset(2),\nwaitid(2),  and  waitpid(2).  See also the discussion of the FGETOWN, FGETOWNEX, FSETOWN,\nand FSETOWNEX operations in fcntl(2).\n"
                },
                {
                    "name": "User and group identifiers",
                    "content": "Each process has various associated user and group IDs.  These IDs are integers, respectively\nrepresented using the types uidt and gidt (defined in <sys/types.h>).\n\nOn Linux, each process has the following user and group identifiers:\n\n•  Real user ID and real group ID.  These IDs determine who owns the process.  A process  can\nobtain its real user (group) ID using getuid(2) (getgid(2)).\n\n•  Effective  user  ID and effective group ID.  These IDs are used by the kernel to determine\nthe permissions that the process will have when accessing shared resources such as message\nqueues, shared memory, and semaphores.  On most UNIX systems, these IDs also determine the\npermissions when accessing files.  However, Linux uses the filesystem IDs described  below\nfor this task.  A process can obtain its effective user (group) ID using geteuid(2) (gete‐\ngid(2)).\n\n•  Saved  set-user-ID  and  saved  set-group-ID.   These IDs are used in set-user-ID and set-\ngroup-ID programs to save a copy of the corresponding effective IDs that were set when the\nprogram was executed (see execve(2)).  A set-user-ID program can assume  and  drop  privi‐\nleges  by  switching  its  effective user ID back and forth between the values in its real\nuser ID and saved set-user-ID.  This switching  is  done  via  calls  to  seteuid(2),  se‐\ntreuid(2),  or  setresuid(2).   A  set-group-ID program performs the analogous tasks using\nsetegid(2), setregid(2), or setresgid(2).  A process  can  obtain  its  saved  set-user-ID\n(set-group-ID) using getresuid(2) (getresgid(2)).\n\n•  Filesystem  user  ID  and filesystem group ID (Linux-specific).  These IDs, in conjunction\nwith the supplementary group IDs described below, are used to  determine  permissions  for\naccessing  files; see pathresolution(7) for details.  Whenever a process's effective user\n(group) ID is changed, the kernel also automatically changes the filesystem  user  (group)\nID  to  the same value.  Consequently, the filesystem IDs normally have the same values as\nthe corresponding effective ID, and the semantics for file-permission checks are thus  the\nsame on Linux as on other UNIX systems.  The filesystem IDs can be made to differ from the\neffective IDs by calling setfsuid(2) and setfsgid(2).\n\n•  Supplementary  group IDs.  This is a set of additional group IDs that are used for permis‐\nsion checks when accessing files and  other  shared  resources.   Before  Linux  2.6.4,  a\nprocess can be a member of up to 32 supplementary groups; since Linux 2.6.4, a process can\nbe a member of up to 65536 supplementary groups.  The call sysconf(SCNGROUPSMAX) can be\nused  to  determine the number of supplementary groups of which a process may be a member.\nA process can obtain its set of supplementary group IDs using getgroups(2).\n\nA child process created by fork(2) inherits copies of its parent's user and groups IDs.  Dur‐\ning an execve(2), a process's real user and group ID and supplementary  group  IDs  are  pre‐\nserved; the effective and saved set IDs may be changed, as described in execve(2).\n\nAside  from  the  purposes noted above, a process's user IDs are also employed in a number of\nother contexts:\n\n•  when determining the permissions for sending signals (see kill(2));\n\n•  when determining the permissions for setting process-scheduling  parameters  (nice  value,\nreal  time  scheduling  policy  and  priority, CPU affinity, I/O priority) using setprior‐\nity(2), schedsetaffinity(2), schedsetscheduler(2), schedsetparam(2),  schedsetattr(2),\nand ioprioset(2);\n\n•  when checking resource limits (see getrlimit(2));\n\n•  when  checking  the  limit  on the number of inotify instances that the process may create\n(see inotify(7)).\n"
                },
                {
                    "name": "Modifying process user and group IDs",
                    "content": "Subject to rules described in the relevant manual pages, a process can use the following APIs\nto modify its user and group IDs:\n\nsetuid(2) (setgid(2))\nModify the process's real (and possibly effective and saved-set) user (group) IDs.\n\nseteuid(2) (setegid(2))\nModify the process's effective user (group) ID.\n\nsetfsuid(2) (setfsgid(2))\nModify the process's filesystem user (group) ID.\n\nsetreuid(2) (setregid(2))\nModify the process's real and effective (and possibly saved-set) user (group) IDs.\n\nsetresuid(2) (setresgid(2))\nModify the process's real, effective, and saved-set user (group) IDs.\n\nsetgroups(2)\nModify the process's supplementary group list.\n\nAny changes to a process's effective user (group) ID are automatically carried  over  to  the\nprocess's  filesystem user (group) ID.  Changes to a process's effective user or group ID can\nalso affect the process \"dumpable\" attribute, as described in prctl(2).\n\nChanges to process user and group IDs can affect the capabilities  of  the  process,  as  de‐\nscribed in capabilities(7).\n"
                }
            ]
        },
        "STANDARDS": {
            "content": "Process IDs, parent process IDs, process group IDs, and session IDs are specified in POSIX.1.\nThe  real, effective, and saved set user and groups IDs, and the supplementary group IDs, are\nspecified in POSIX.1.\n\nThe filesystem user and group IDs are a Linux extension.\n",
            "subsections": []
        },
        "NOTES": {
            "content": "Various fields in the /proc/pid/status file show the  process  credentials  described  above.\nSee proc(5) for further information.\n\nThe POSIX threads specification requires that credentials are shared by all of the threads in\na process.  However, at the kernel level, Linux maintains separate user and group credentials\nfor  each thread.  The NPTL threading implementation does some work to ensure that any change\nto user or group credentials (e.g., calls to setuid(2), setresuid(2)) is carried  through  to\nall of the POSIX threads in a process.  See nptl(7) for further details.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "bash(1),  csh(1),  groups(1),  id(1), newgrp(1), ps(1), runuser(1), setpriv(1), sg(1), su(1),\naccess(2), execve(2), faccessat(2), fork(2), getgroups(2), getpgrp(2), getpid(2), getppid(2),\ngetsid(2),  kill(2),  setegid(2),  seteuid(2),  setfsgid(2),  setfsuid(2),  setgid(2),   set‐\ngroups(2),  setpgid(2), setresgid(2), setresuid(2), setsid(2), setuid(2), waitpid(2), euidac‐\ncess(3),  initgroups(3),  killpg(3),  tcgetpgrp(3),  tcgetsid(3),   tcsetpgrp(3),   group(5),\npasswd(5),  shadow(5), capabilities(7), namespaces(7), pathresolution(7), pidnamespaces(7),\npthreads(7), signal(7), systemdatatypes(7), unix(7), usernamespaces(7), sudo(8)\n\nLinux man-pages 6.7                          2023-11-19                               credentials(7)",
            "subsections": []
        }
    },
    "summary": "credentials - process identifiers",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "bash",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/bash/1/json"
        },
        {
            "name": "csh",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/csh/1/json"
        },
        {
            "name": "groups",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/groups/1/json"
        },
        {
            "name": "id",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/id/1/json"
        },
        {
            "name": "newgrp",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/newgrp/1/json"
        },
        {
            "name": "ps",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/ps/1/json"
        },
        {
            "name": "runuser",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/runuser/1/json"
        },
        {
            "name": "setpriv",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/setpriv/1/json"
        },
        {
            "name": "sg",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/sg/1/json"
        },
        {
            "name": "su",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/su/1/json"
        },
        {
            "name": "access",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/access/2/json"
        },
        {
            "name": "execve",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/execve/2/json"
        },
        {
            "name": "faccessat",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/faccessat/2/json"
        },
        {
            "name": "fork",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/fork/2/json"
        },
        {
            "name": "getgroups",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/getgroups/2/json"
        },
        {
            "name": "getpgrp",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/getpgrp/2/json"
        },
        {
            "name": "getpid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/getpid/2/json"
        },
        {
            "name": "getppid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/getppid/2/json"
        },
        {
            "name": "getsid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/getsid/2/json"
        },
        {
            "name": "kill",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/kill/2/json"
        },
        {
            "name": "setegid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setegid/2/json"
        },
        {
            "name": "seteuid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/seteuid/2/json"
        },
        {
            "name": "setfsgid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setfsgid/2/json"
        },
        {
            "name": "setfsuid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setfsuid/2/json"
        },
        {
            "name": "setgid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setgid/2/json"
        },
        {
            "name": "groups",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/groups/2/json"
        },
        {
            "name": "setpgid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setpgid/2/json"
        },
        {
            "name": "setresgid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setresgid/2/json"
        },
        {
            "name": "setresuid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setresuid/2/json"
        },
        {
            "name": "setsid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setsid/2/json"
        },
        {
            "name": "setuid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setuid/2/json"
        },
        {
            "name": "waitpid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/waitpid/2/json"
        },
        {
            "name": "cess",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/cess/3/json"
        },
        {
            "name": "initgroups",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/initgroups/3/json"
        },
        {
            "name": "killpg",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/killpg/3/json"
        },
        {
            "name": "tcgetpgrp",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/tcgetpgrp/3/json"
        },
        {
            "name": "tcgetsid",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/tcgetsid/3/json"
        },
        {
            "name": "tcsetpgrp",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/tcsetpgrp/3/json"
        },
        {
            "name": "group",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/group/5/json"
        },
        {
            "name": "passwd",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/passwd/5/json"
        },
        {
            "name": "shadow",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/shadow/5/json"
        },
        {
            "name": "capabilities",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/capabilities/7/json"
        },
        {
            "name": "namespaces",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/namespaces/7/json"
        },
        {
            "name": "pathresolution",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pathresolution/7/json"
        },
        {
            "name": "pidnamespaces",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pidnamespaces/7/json"
        },
        {
            "name": "pthreads",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/pthreads/7/json"
        },
        {
            "name": "signal",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/signal/7/json"
        },
        {
            "name": "systemdatatypes",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/systemdatatypes/7/json"
        },
        {
            "name": "unix",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/unix/7/json"
        },
        {
            "name": "usernamespaces",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/usernamespaces/7/json"
        },
        {
            "name": "sudo",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sudo/8/json"
        }
    ]
}