A Linux administrator needs to define a system-wide environment variable that must be set for all users when they initiate a login shell. This variable should not affect non-login shells or system services that do not start with a login shell. Which of the following files is the most appropriate for this configuration?
The correct answer is /etc/profile. This file is executed for all users whenever a login shell is started. It is the standard and most appropriate location for setting system-wide environment variables and running commands that should only apply to login sessions. /etc/bashrc is incorrect because it is sourced for interactive non-login shells, not specifically login shells. ~/.profile is incorrect because it is a user-specific file, located in a user's home directory, and does not apply system-wide. /etc/skel/.profile is a template file used only when new user accounts are created; it does not affect existing users.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What is the difference between a login shell and a non-login shell?
Open an interactive chat with Bash
Why is `/etc/profile` specifically used for system-wide configuration?
Open an interactive chat with Bash
How does `/etc/skel` differ from `/etc/profile` in terms of functionality?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access