nerdexam
CompTIA

LX0-104 · Question #7

What is the purpose of the file /etc/profile?

The correct answer is C. It contains environment variables that are set when a user logs in.. The /etc/profile file is a system-wide initialization script executed by all login shells for all users on a Linux system. Its primary purpose is to set global environment variables and execute startup scripts that apply to all users upon login.

Administrative Tasks

Question

What is the purpose of the file /etc/profile?

Options

  • AIt contains the welcome message that is displayed after login.
  • BIt contains security profiles defining which users are allowed to log in.
  • CIt contains environment variables that are set when a user logs in.
  • DIt contains default application profiles for users that run an application for the first time.

How the community answered

(45 responses)
  • A
    2% (1)
  • B
    4% (2)
  • C
    87% (39)
  • D
    7% (3)

Why each option

The `/etc/profile` file is a system-wide initialization script executed by all login shells for all users on a Linux system. Its primary purpose is to set global environment variables and execute startup scripts that apply to all users upon login.

AIt contains the welcome message that is displayed after login.

The welcome message is typically displayed by `/etc/motd` (Message Of The Day) or similar files, not `/etc/profile`.

BIt contains security profiles defining which users are allowed to log in.

Security profiles and access control are typically managed by PAM (Pluggable Authentication Modules) configurations, not `/etc/profile`.

CIt contains environment variables that are set when a user logs in.Correct

The `/etc/profile` file is a system-wide configuration script sourced by login shells, and it is used to set environment variables and execute commands that affect all users' environments after they log in.

DIt contains default application profiles for users that run an application for the first time.

Application profiles are generally managed by individual application configuration files or user-specific dotfiles, not by the system-wide `/etc/profile`.

Concept tested: /etc/profile purpose

Source: https://www.man7.org/linux/man-pages/man5/profile.5.html

Topics

#login shell#environment variables#/etc/profile#shell configuration

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice