Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a Bash script called pass check that has a single possible command line ar

ID: 652183 • Letter: W

Question

Write a Bash script called pass check that has a single possible command line argument, and makes a report about the validity of entries in passwd file. If no command line argument is given you should assume that /etc/passwd should be analyzed, otherwise the file specified should be used (more than one argument in an error). Each line of the file should be examined and the following errors detected if they exist:1)If the UID is greater than 500 then make sure the specified shell is listed in the /etc/shells file and the permissions of the home directory are 700.2)If the UID is 0 then make the username is root and the GID is 0.Make sure there are no duplicate UID

Explanation / Answer

yeah to check integrity of your password you can directly use sinlge command line function available in linux.

That is pwck-----pwck - verify integrity of password files

syntax to use pwck:

pwck [-q] [-s] [passwd ]

pwck [-q] [-r] [passwd ]

checking will be done for following cases: is fields are correct, user name is valid and unique, is user is valid and froup identifier, primary, homegrpup,login shell are valid or not.

Another advantage of this is using these commands it wont corrupt the passwd file given.

Here script

#!/bin/bash
# grpck
# echo $?
# pwck
---->you can pass here your file to check

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote