nerdexam
Linux_Foundation

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.

Submitted by yaw92· Apr 18, 2026User and Group Management

Question

In what file do you change default shell variables for all users?

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)
  • B
    93% (26)
  • C
    4% (1)
  • D
    4% (1)

Why each option

To define default shell variables for all users system-wide, the `/etc/profile` file should be modified.

A/etc/bashrc

`/etc/bashrc` is typically sourced by interactive non-login shells, often after `/etc/profile` has already set global variables for login shells.

B/etc/profileCorrect

`/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.

C~/.bash_profile

`~/.bash_profile` is a user-specific file executed only for the owner of the home directory, not for all users.

D/etc/skel/.bashrc

`/etc/skel/.bashrc` is a template file copied to new user home directories and does not affect existing users.

E/etc/skel/.bash_profile

`/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

#Shell configuration#Environment variables#Global settings#Login scripts

Community Discussion

No community discussion yet for this question.

Full LFCS Practice