CompTIA Linux+ Practice Questions

CompTIA Linux+ (XK0-006) exam preparation

CompTIA Linux+ practice questions in English: 180 questions with explanations. The mock exam has 90 questions and 90 minutes.

CompTIA Linux+ free question 6 / 10 · Domain 3: Security

An administrator lets the user aaron run /usr/bin/more and /usr/bin/vi through sudo on one host. Both programs can start a shell from inside, which would let aaron bypass the access control of sudo. Which tag in the sudoers file does the manual page describe for preventing these programs from running further commands?

  1. NOFOLLOW, which stops sudoedit from opening a file that is a symbolic link, per command
  2. NOPASSWD, which lets the user run the listed commands and skip authenticating at the prompt
  3. NOEXEC, which prevents a dynamically-linked executable from running further commands itself
  4. INTERCEPT, which validates the programs spawned by a command against sudoers and logs them
Show the answer and explanation

Answer: C

Why this is correct
The sudoers page explains that once sudo executes a program, the program is free to run other programs, and that editors and paginators are common sources of such shell escapes. If sudo supports it on the operating system, the NOEXEC tag prevents a dynamically-linked executable from running further commands, and the page gives more and vi as its example. INTERCEPT only validates and logs them, NOPASSWD concerns authentication, and NOFOLLOW concerns sudoedit.

Why the other options are wrong
"INTERCEPT, which validates the programs spawned by a command against sudoers and logs them" … The page describes INTERCEPT as validating and logging the programs that a command spawns, as if they were run through sudo. They still run, so it does not prevent them from starting further commands.
"NOPASSWD, which lets the user run the listed commands and skip authenticating at the prompt" … The page describes NOPASSWD as removing the authentication that sudo requires by default. It changes how the user proves identity and does not restrict what the program does.
"NOFOLLOW, which stops sudoedit from opening a file that is a symbolic link, per command" … The page says the FOLLOW and NOFOLLOW tags override sudoedit_follow and are only effective for the sudoedit command. They have no effect on programs such as more and vi.

Key points
NOEXEC blocks shell escapes where it is supported, and INTERCEPT validates and logs spawned programs where it is supported. Both depend on support in sudo and in the operating system.

Go to the CompTIA Linux+ practice app (10 free questions; purchase unlocks all questions)

See the full practice set