Linux uid pid ppid

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

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.

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.

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.

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.

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.

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:

Читайте также:  Команды при загрузке линукс

Источник

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

unix.stackexchange.com/questions/82724 has names for PGID and SID, if that’s what you’re looking for.

Two possibilities: your teacher wants you to print environment variables variables or your teacher wants you to use UNIX APIs to get the values that the system put into those variables. E.g. PPID is parent’s process PID. Try echo $PPID to see it in your environment.

1 Answer 1

  • 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.

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.

Читайте также:  Нет пароля linux mint

Источник

Оцените статью
Adblock
detector