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:

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.