LFCS · 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 file is the appropriate configuration file to modify.
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
(35 responses)- B91% (32)
- C3% (1)
- D6% (2)
Why each option
To set default shell variables for all users system-wide, the /etc/profile file is the appropriate configuration file to modify.
/etc/bashrc is typically executed for interactive non-login shells. While it can be sourced by /etc/profile or user .bashrc files, /etc/profile is the primary place for system-wide login shell variables.
The /etc/profile file is a system-wide configuration script executed by login shells for all users. It is designed for setting global environment variables, PATH, and other default shell settings that should apply to every user upon successful login.
`~default/.bash_profile` refers to a specific user's (named 'default') login shell configuration, not a global system-wide file for all users.
Files in /etc/skel/ are templates copied to new user home directories; they do not affect existing users or provide global system-wide settings directly.
Similar to D, files in /etc/skel/ are templates for new users and do not set global default variables for all current users.
Concept tested: Global shell initialization files
Source: https://man7.org/linux/man-pages/man5/profile.5.html
Topics
Community Discussion
No community discussion yet for this question.