LFCS · Question #462
In what file do you change default shell variables for all users?
The correct answer is B. /etc/profile. To define default shell variables for all users system-wide, the /etc/profile file should be modified.
Question
Options
- A/etc/bashrc
- B/etc/profile
- C~/.bash_profile
- D/etc/skel/.bashrc
- E/etc/skel/.bash_profile
How the community answered
(28 responses)- B93% (26)
- C4% (1)
- D4% (1)
Why each option
To define default shell variables for all users system-wide, the `/etc/profile` file should be modified.
`/etc/bashrc` is typically sourced by interactive non-login shells, often after `/etc/profile` has already set global variables for login shells.
`/etc/profile` is a system-wide initialization file executed by login shells for all users, making it the standard location for setting global environment variables and commands affecting every user.
`~/.bash_profile` is a user-specific file executed only for the owner of the home directory, not for all users.
`/etc/skel/.bashrc` is a template file copied to new user home directories and does not affect existing users.
`/etc/skel/.bash_profile` is a template file copied to new user home directories and does not affect existing users.
Concept tested: System-wide login shell configuration
Source: https://www.gnu.org/software/bash/manual/bash.html#Bash-Startup-Files
Topics
Community Discussion
No community discussion yet for this question.