Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?
like image 955
David Deme Avatar asked Jan 06 '17 03:01

David Deme


People also ask

What is PID UID and PPID?

ppid : The PID of the parent process (the process that spawned the current one). For example, if you run ruby test. rb in a bash shell, PPID in that process would be the PID of Bash. uid : The UNIX ID of the user the process is running under. euid : The effective user ID that the process is running under.

What does Pgid stand for Linux?

PGID. Each process in a process group shares a process group ID (PGID), which is the same as the PID of the first process in the process group. This ID is used for signaling related processes. If a command starts just one process, its PID and PGID are the same. PPID.

What is PID and UID?

UID. The effective user ID of the process's owner. PID. The process ID.

What is PID and PPID in Unix?

Parent and Child Processes Each unix process has two ID numbers assigned to it: The Process ID (pid) and the Parent process ID (ppid). Each user process in the system has a parent process. Most of the commands that you run have the shell as their parent.


1 Answers

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.

This page from the RedHat 6.x docs has a pretty good 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

like image 106
ti7 Avatar answered Sep 30 '22 12:09

ti7