What is the difference between a Process' pid, ppid, uid, euid, gid and egid?

PID:

In Linux, an executable stored on disk is called a program, and a program loaded into memory and running is called a process. When a process is started, it is given a unique number called process ID (PID) that identifies that process to the system. If you ever need to kill a process, for example, you can refer to it by its PID.

PPID:

In addition to a unique process ID, each process is assigned a parent process ID (PPID) that tells which process started it. The PPID is the PID of the process’s parent.

For example, if process1 with a PID of 101 starts a process named process2, then process2 will be given a unique PID, such as 3240, but it will be given the PPID of 101. It’s a parent-child relationship. A single parent process may spawn several child processes, each with a unique PID but all sharing the same PPID.

UID:

Unix-like operating systems identify users within the kernel by a value called a user identifier, often abbreviated to UID or User ID. The UID, along with the GID and other access control criteria, is used to determine which system resources a user can access. The password file maps textual usernames to UIDs, but in the kernel, only UID's are used.

EUID:

The effective UID (euid) of a process is used for most access checks. It is also used as the owner for files created by that process.

GID:

A group identifier, often abbreviated to GID, is a numeric value used to represent a specific group. The range of values for a GID varies amongst different systems; at the very least, a GID can be between 0 and 32,767, with one restriction: the login group for the superuser must have GID 0.

EGID:

The effective GID (egid) of a process also affects access control and may also affect file creation, depending on the semantics of the specific kernel implementation in use and possibly the mount options used.

Refer these articles for more information:

  1. What are PID and PPID?
  2. Meaning of PID, PPID and TGID
  3. User identifier
  4. Group identifier

In order:

  • pid: The is the process ID (PID) of the process you call the Process.pid method in.
  • 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. The EUID determines what a program is allowed to do, based on what the user with this UID is allowed to do. Typically the same as uid, but can be different with commands like sudo.
  • gid: The UNIX group ID the program is running under.
  • egid: Like euid, but for groups.

Tags:

Ruby

Process

Pid