'What do the identifiers PID, PPID, SID, PGID, UID, EUID mean?

I was assigned to

Write a C program that prints the following identifiers PID, PPID, SID, PGID, UID, EUID.

The assignment then went on to ask

What represents each identifier?

I have completed the program, but have not found adequate explanations for the identifiers.

  • What do they really represent?
  • Especially what is the purpose of the SID and PGID identifiers?


Solution 1:[1]

They're as follows

  • PID - Process ID
  • PPID - Parent Process ID
  • SID - Session ID
  • PGID - Process Group ID
  • UID - User ID
  • EUID - Effective User ID

Take a look at this SO Post and the first answer for a healthy explanation of what they're for.

From the recommended page of definitions they posted
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html

3.270 Parent Process ID

An attribute of a new process identifying the parent of the process. The parent process ID of a process is the process ID of its creator, for the lifetime of the creator. After the creator's lifetime has ended, the parent process ID is the process ID of an implementation-defined system process.

3.343 Session

A collection of process groups established for job control purposes. Each process group is a member of a session. A process is considered to be a member of the session of which its process group is a member. A newly created process joins the session of its creator. A process can alter its session membership; see setsid(). There can be multiple process groups in the same session.

3.296 Process Group

A collection of processes that permits the signaling of related processes. Each process in the system is a member of a process group that is identified by a process group ID. A newly created process joins the process group of its creator.

3.297 Process Group ID

The unique positive integer identifier representing a process group during its lifetime.

3.142 Effective User ID

An attribute of a process that is used in determining various permissions, including file access permissions; see also User ID.


Note that the EUID and EGID (Effect Group ID) are not used for filesystem permissions under Linux which takes filesystem's FSUID and FSGID fields respectively instead.

Summary of Linux Security Features from the RedHat 6.x docs has a good and concise explanation of how these behave under Linux:
http://www.mit.edu/afs.new/athena/system/rhlinux/redhat-6.2-docs/HOWTOS/other-formats/html/Secure-Programs-HOWTO-html/Secure-Programs-HOWTO-3.html

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1