CYB 300: 6-3 Activity: Scripting Administrative Tasks ...
Scripting Administrative Tasks
Overview
Scripting is an essential skill that helps all IT professionals increase productivity and handle tasks that are repetitive in nature. Learning how to write or modify scripts can save you an immense amount of time. Using the Linux Bash scripting provides an avenue to manipulate the internals of a computer while abiding by policies and security controls that have been put in place within the computer. It should be noted that Bash scripts do not circumvent user rights and privileges. Therefore, if you are trying to run a script and your access is denied to any of the commands, you need to seek to escalate your privileges for that script to run. This is a key safety control in operating systems to ensure individuals cannot perform tasks above their security levels.
You will be working in the CYB 300 Sandbox environment. Your submission will include three documents: two .txt script files and a Word document containing screenshots.
Note: The Learning Management System will not accept .sh files for submission. You can open your .sh file in a text editor and save the file as a .txt file for submission.
Scenario
You are an analyst at a small firm, and your manager has tasked you with writing a script to automate tasks. To test your script, you have been given a sandbox environment that mimics your live Linux system. Your manager has identified the need for scripts to automate the following tasks, to be divided up by you and your coworkers:
- Create three groups: Human Resources, Finance, and Sales. Create 12 user accounts and place them in one of the three groups. Set the passwords to NewP@$$w0rd
- Create a script to back up the /home directory as a compressed tar file to a folder called /backup
- Use the Ping utility to report connections of all IP addresses that end in an odd number in the network, and output them to a text file called ping.txt
- Create a user group named Audit and include all the employees of the HR and Finance organizational units
- Find all users with inactive and disabled accounts across all organizational units and output the list to a text file named inactive_users.txt
- Get a list of all running processes and output the list to a text file named running_processes.txt
Your work assignment is to select two of the above tasks and create a script to automate each one that you have chosen.
Prompt
In this assignment, incorporate the following elements in each script:
- Repetition structure
- Compound conditional statement
- Variable declaration and usage
For each element, add a comment describing the element for each of the three requirements above. You must also add your name, date, and course title as a comment at the beginning of your script. Each script must contain at least four comments.
You must address the critical elements listed below.
- Automated Script One
- Script contains a repetition structure
- Script contains a compound conditional statement
- Script contains variable declaration and usage
- Script file
- Results: Provide screenshot evidence that the script has performed the desired task
- Automated Script Two
- Script contains a repetition structure
- Script contains a compound conditional statement
- Script contains variable declaration and usage
- Script file
- Results: Provide screenshot evidence that the script has performed the desired task
- Scripting Best Practices
- Name, date, and course title
- Comments for the three required elements of the script
- Code is properly commented and contains the following comments: