102-500 · Question #188
Which of the following configuration files should be modified to set default shell variables for all users?
The correct answer is B. /etc/profile. /etc/profile is the system-wide initialization file sourced by login shells for all users, making it the correct place to set default shell variables globally. Option A (/etc/bashrc) is a common distractor - while it exists on some distros (like Red Hat-based systems), it's…
Question
Options
- A/etc/bashrc
- B/etc/profile
- C~/.bash_profile
- D/etc/.bashrc
How the community answered
(42 responses)- A5% (2)
- B74% (31)
- C14% (6)
- D7% (3)
Explanation
/etc/profile is the system-wide initialization file sourced by login shells for all users, making it the correct place to set default shell variables globally. Option A (/etc/bashrc) is a common distractor - while it exists on some distros (like Red Hat-based systems), it's intended for interactive non-login shells and is not the canonical cross-distro answer for all users. Option C (~/.bash_profile) only applies to the individual user whose home directory it lives in, not all users. Option D (/etc/.bashrc) is not a real standard path - .bashrc belongs in /etc/ as /etc/bashrc, and even then it serves non-login shells rather than being the primary global config.
Memory tip: Think of /etc/profile as the "profile for everyone" - /etc/ means system-wide, and profile = the first thing a user's login shell reads.
Topics
Community Discussion
No community discussion yet for this question.