ExamGecko
Question list
Search
Search

Question 439 - 200-901 discussion

Report
Export

Refer to the exhibit.

An engineer must add new users and set privileges for executing a few Python scripts. The engineer prepares a Bash script to automate this task. The script ds a user and a group from the command-line arguments, creates a directory, and copies the Python scripts to it. The script then changes to the directory and lists the scripts, used on the script workflow, which process is being automated within the loop by using the list of Python scripts?

A.

removing the files that are not Python, listing the Python files, and assigning execution privileges to the initially created user and group.

Answers
A.

removing the files that are not Python, listing the Python files, and assigning execution privileges to the initially created user and group.

B.

assigning execution privileges to everyone and changing the ownership to the initially created user and group

Answers
B.

assigning execution privileges to everyone and changing the ownership to the initially created user and group

C.

assigning execution privileges to the owner, setting the user and group owner to the scripts that were initially created, and storing the script names in a file.

Answers
C.

assigning execution privileges to the owner, setting the user and group owner to the scripts that were initially created, and storing the script names in a file.

D.

creating a file with the content of all the files, assigning execution permissions to each script, and then changing ownership to the initially created user and group.

Answers
D.

creating a file with the content of all the files, assigning execution permissions to each script, and then changing ownership to the initially created user and group.

Suggested answer: C

Explanation:

The provided Bash script performs the following steps:

Adds a new user with useradd.

Adds a new group with groupadd.

Creates a directory /opt/scripts.

Copies all Python scripts (*.py) to the /opt/scripts directory.

Changes to the /opt/scripts directory.

Lists the Python scripts and processes each script in a loop.

Within the loop, the script:

Appends the script name to a file content.txt.

Assigns execution privileges to the script (chmod u+x).

Changes the ownership of the script to the newly created user and group (chown $1:$2).

This workflow automates the process of setting execution permissions for the owner (the newly created user) and assigning the user and group ownership to the scripts. It also stores the script names in content.txt.

Cisco DevNet Associate Certification Guide

Bash Scripting Documentation

asked 07/10/2024
Hassene SAADI
30 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first