nerdexam
CompTIA

LX0-104 · Question #266

Which of the following configuration files should be modified to set default shell variables for all users?

The correct answer is B. /etc/profile. To set default shell variables for all users system-wide, the /etc/profile configuration file should be modified.

Shells, Scripting and Data Management

Question

Which of the following configuration files should be modified to set default shell variables for all users?

Options

  • A/etc/bashrc
  • B/etc/profile
  • C~default/.bash_profile
  • D/etc/skel/.bashrc
  • E/etc/skel/.bash_profile

How the community answered

(33 responses)
  • A
    6% (2)
  • B
    91% (30)
  • E
    3% (1)

Why each option

To set default shell variables for all users system-wide, the `/etc/profile` configuration file should be modified.

A/etc/bashrc

`/etc/bashrc` is processed for interactive non-login Bash shells, typically setting shell-specific functions and aliases, but `/etc/profile` is used for system-wide variables upon login.

B/etc/profileCorrect

The `/etc/profile` file is executed for all users when they log in to a Bourne-compatible shell (like Bash) and is the standard location for setting system-wide environment variables and commands. This ensures that all users inherit these common settings upon starting their login session.

C~default/.bash_profile

`~default/.bash_profile` is a per-user configuration file for a specific user named 'default', not a system-wide setting for all users.

D/etc/skel/.bashrc

`/etc/skel/.bashrc` provides template files that are copied to a *new* user's home directory during account creation, not a file applied directly to all existing or new users.

E/etc/skel/.bash_profile

`/etc/skel/.bash_profile` provides template files that are copied to a *new* user's home directory during account creation, not a file applied directly to all existing or new users.

Concept tested: Linux shell initialization files

Source: https://www.gnu.org/software/bash/manual/bash.html#Bash-Startup-Files

Topics

#shell configuration#environment variables#bash profile

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice