Linux Administration
medium

Pregunta de Linux Administration #019e3987

Enunciado de la Pregunta
Linux Administration
#/etc/profile
#environment-variables
#login-shell
#bash
#shell-initialization
Medio

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

A

It contains the welcome message that is displayed after login.

B

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

C

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

Correcto
D

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

Explicación Oficial / Explicaciones de la Comunidad

The /etc/profile file is a system-wide shell initialization script that sets environment variables and defines startup programs for all users when they log in. It is executed by Bourne-compatible shells (e.g., bash, sh) upon login.

How it Works

When a user logs in, the login shell reads /etc/profile first, then the user's personal ~/.profile (or ~/.bash_profile, ~/.bash_login). This file typically sets variables like PATH, EDITOR, MAIL, and umask, and may source additional scripts in /etc/profile.d/.

Why the Correct Value is Right

The correct value states that /etc/profile contains environment variables that are set when a user logs in. This is accurate because the file's primary purpose is to establish a consistent environment for all users by exporting variables and running commands at login.

Why the Incorrect Values are Wrong

  • The welcome message displayed after login is typically configured in /etc/issue or /etc/motd, not /etc/profile. While /etc/profile could be modified to display a message, that is not its intended purpose.
  • Security profiles defining which users are allowed to log in are managed by files like /etc/passwd, /etc/shadow, and PAM configuration (e.g., /etc/security/access.conf). /etc/profile does not control user authentication.
  • Default application profiles for first-time users are not handled by /etc/profile. Application defaults are usually stored in /etc/skel/ (skeleton files copied to new home directories) or in application-specific configuration directories.