nerdexam
GIAC

GSEC · Question #370

John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He executes the following…

The correct answer is B. root, 0. In Linux, the $USER environment variable holds the username of the currently logged-in user, and $UID holds the numeric user ID. The root account is the superuser in Linux and always has a UID of 0 - this is hardcoded by the OS. When John runs the command as the root user…

Linux and Cryptography

Question

John works as a Network Administrator for Perfect Solutions Inc. The company has a Linux- based network. John is working as a root user on the Linux operating system. He executes the following command in the terminal:

echo $USER, $UID Which of the following will be displayed as the correct output of the above command?

Options

  • Aroot, 500
  • Broot, 0
  • CJohn, 502
  • DJohn, 0

How the community answered

(48 responses)
  • A
    15% (7)
  • B
    75% (36)
  • C
    4% (2)
  • D
    6% (3)

Explanation

In Linux, the $USER environment variable holds the username of the currently logged-in user, and $UID holds the numeric user ID. The root account is the superuser in Linux and always has a UID of 0 - this is hardcoded by the OS. When John runs the command as the root user, $USER resolves to 'root' and $UID resolves to '0'. Regular users (like John's personal account) would typically have UIDs starting at 500 or 1000 depending on the distribution. Since the problem states John is working as a root user, the output is 'root, 0', not any value tied to John's personal account.

Topics

#Linux#root user#UID#shell environment variables

Community Discussion

No community discussion yet for this question.

Full GSEC Practice