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.
Question
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)- A6% (2)
- B91% (30)
- E3% (1)
Why each option
To set default shell variables for all users system-wide, the `/etc/profile` configuration file should be modified.
`/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.
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.
`~default/.bash_profile` is a per-user configuration file for a specific user named 'default', not a system-wide setting for all users.
`/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.
`/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
Community Discussion
No community discussion yet for this question.