CST8177 - Lab 11 Searching the password file Student Name Student number Lab section: Objective To practice problem-solving skills with several small scripts and their PDL, Data Dictionary (where necessary), and so on. Note: Print out your finished PDL, scripts , and test output to include in your Lab Book. In-Lab Demo -- Demo the scripts from in this lab, explaining the behaviour. Searching the password file Task #1 The following scripts and PDL should be stored in your bin directory; if you don't yet have one in your home directory, then create one. You could always use what you learned in updpath to modify your .bashrc file (of course, you will back it up first) to add your own bin directory (and ./, the pwd, if you wish). Write a short script, named spw, that does the following: Verify that the user is root; if not, exit with an error. Verify that the password file exists; if not, exit with an error. Prompt for and read a user name (watch the format of your prompt). How can you check for entry errors? Search the password file for the user name, ensuring that it is the account id and only the account id, and that there cannot be any duplicates found. If the entry exists, display the user's password file entry. If the user does not exist, report that the user is not found. Additionally, add the username into a variable called noaccts. This variable will eventually contain a comma-separated list (known as CSV, comma-separated values) of all users that don't have accounts. Prompt for another user name, ending your loop at end-of-file (^D). When the user wants to exit, display the list of users that don't have accounts if noaccts is not just an empty string. Test it thoroughly, with good input and bad. Task #2 For each valid account, also search for their shadow file entry. Display both lines of output on stdout. Task #3 Finally, for each valid account search for their correct entry in the group file and display it with the lines from both passwd and shadow.