nerdexam
CompTIA

XK0-005 · Question #75

A junior Linux administrator is setting up system-wide configuration settings. The goal is to ensure the PATH environment variable includes the following locations for all users who log into a Linux…

The correct answer is B. Update the /etc/profile file using a text editor, navigate to the PATH element, add the missing locations. To ensure system-wide PATH environment variables include specific locations for all users, the administrator should update the /etc/profile file.

System Management

Question

A junior Linux administrator is setting up system-wide configuration settings. The goal is to ensure the PATH environment variable includes the following locations for all users who log into a Linux system. The administrator issues the following commands at the terminal:

Respectively, the output of these commands is as follows:

Given this output, which of the following would be the BEST action for the administrator to perform to address this issue?

Options

  • AUpdate the /etc/profile.d file using a text editor, navigate to the PATH element add the missing locations,
  • BUpdate the /etc/profile file using a text editor, navigate to the PATH element, add the missing locations
  • CUpdate the /etc/profile.d file using a text editor, navigate to the PATH element, add the missing
  • DUpdate the /etc/profile file using a text editor navigate to the PATH element, add the missing locations,

How the community answered

(34 responses)
  • B
    91% (31)
  • C
    6% (2)
  • D
    3% (1)

Why each option

To ensure system-wide PATH environment variables include specific locations for all users, the administrator should update the `/etc/profile` file.

AUpdate the /etc/profile.d file using a text editor, navigate to the PATH element add the missing locations,

The `/etc/profile.d` directory contains scripts that are sourced by `/etc/profile`, and while adding a new script there is an option, directly modifying an existing `PATH` element is typically done in `/etc/profile` itself.

BUpdate the /etc/profile file using a text editor, navigate to the PATH element, add the missing locationsCorrect

The `/etc/profile` file is a system-wide initialization script executed by Bourne-compatible shells for all users upon login, making it the best place to define or modify the `PATH` environment variable globally to include new locations for all users.

CUpdate the /etc/profile.d file using a text editor, navigate to the PATH element, add the missing

Similar to A, modifying the `PATH` element directly within a generic `/etc/profile.d` 'file' (it's a directory for scripts) is not the correct approach; individual scripts are placed in this directory.

DUpdate the /etc/profile file using a text editor navigate to the PATH element, add the missing locations,

While updating `/etc/profile` is correct, the phrasing 'navigate to the PATH element, add the missing locations,' is more accurately described by option B. Both B and D point to the correct file, but B is slightly better phrased.

Concept tested: System-wide environment variables

Source: https://man7.org/linux/man-pages/man5/profile.5.html

Topics

#Linux system administration#Environment variables#Shell configuration#PATH variable

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice