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.
Question
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)- A2% (1)
- B92% (45)
- C2% (1)
- E4% (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.
`/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`.
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.
`~/.bash_profile` is a user-specific configuration file, affecting only the individual user's login shell.
`/etc/skel/.bashrc` is a template file used when new user accounts are created, not a file sourced at login by existing users.
`/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
Community Discussion
No community discussion yet for this question.