A system administrator must allow a user named johndoe to run a backup script located at /usr/local/bin/backup.sh without being prompted for a password. The change must be made safely with automatic syntax validation. Which of the following lines should be added to the sudoers file using the visudo command?
The correct entry is johndoe ALL=(ALL) NOPASSWD: /usr/local/bin/backup.sh. It limits the privilege to the single backup script, sets the NOPASSWD tag so no password is required, and follows the correct sudoers syntax order (user hostlist = runaslist tag : command). Editing through visudo locks the file and refuses to save if a syntax error is detected, preventing configuration mistakes. The other options either omit the NOPASSWD tag, grant overly broad permissions, or place the fields in the wrong order, making them invalid or insecure.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the NOPASSWD option in the sudoers file do?
Open an interactive chat with Bash
What is the `visudo` command and why is it important?
Open an interactive chat with Bash
What are some common mistakes when configuring the sudoers file?