nerdexam
CompTIA

LX0-104 · Question #462

In what file do you change default shell variables for all users?

The correct answer is B. /etc/profile. To set default shell variables or commands for all users on a system, a global system-wide configuration file is used.

Shells, Scripting and Data Management

Question

In what file do you change default shell variables for all users?

Options

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

How the community answered

(49 responses)
  • A
    2% (1)
  • B
    92% (45)
  • C
    2% (1)
  • E
    4% (2)

Why each option

To set default shell variables or commands for all users on a system, a global system-wide configuration file is used.

A/etc/bashrc

`/etc/bashrc` is often used for system-wide interactive shell settings but might not be sourced by all shell types or login shells, unlike `/etc/profile`.

B/etc/profileCorrect

The `/etc/profile` file is a system-wide configuration file that is sourced by bash for every user upon login, making it the appropriate place to set default shell variables and environment settings that apply to all users on the system.

C~/.bash_profile

`~/.bash_profile` is a user-specific configuration file, affecting only the individual user's login shell.

D/etc/skel/.bashrc

`/etc/skel/.bashrc` is a template file used when new user accounts are created, not a file sourced at login by existing users.

E/etc/skel/.bash_profile

`/etc/skel/.bash_profile` is also a template file for new users, not a system-wide configuration file for existing users.

Concept tested: Global shell environment configuration

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

Topics

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

Community Discussion

No community discussion yet for this question.

Full LX0-104 Practice