nerdexam
CompTIA

XK0-005 · Question #884

A systems administrator wants to execute /usr/local/bin/script.sh from the user1 account. Which of the following commands will accomplish this task?

The correct answer is B. su - user1 /usr/local/bin/script.sh. The su - user1 /usr/local/bin/script.sh command switches to the user1 account with a login shell (the -), and passes the script path so that it runs under user1’s identity. The other options either misuse the -c flag or invoke sudo incorrectly.

System Management

Question

A systems administrator wants to execute /usr/local/bin/script.sh from the user1 account. Which of the following commands will accomplish this task?

Options

  • Asu -c user1 /usr/local/bin/script.sh
  • Bsu - user1 /usr/local/bin/script.sh
  • Dsudo -1 user1 /usr/local/bin/script.sh

How the community answered

(29 responses)
  • A
    10% (3)
  • B
    72% (21)
  • D
    17% (5)

Explanation

The su - user1 /usr/local/bin/script.sh command switches to the user1 account with a login shell (the -), and passes the script path so that it runs under user1’s identity. The other options either misuse the -c flag or invoke sudo incorrectly.

Topics

#su command#User management#Command execution#Linux shell

Community Discussion

No community discussion yet for this question.

Full XK0-005 Practice