Write a bash script to protect a directory. Your script should notify a user of
ID: 3814767 • Letter: W
Question
Write a bash script to protect a directory. Your script should notify a user of the following:
New file was created
Permission changes
Ownership changes
File size changes
Modification date changes
Your script should have two operation modes, protect and check.
Use command line flags, -p <directory> and -c <directory> to decide which mode to operate in.
In protect mode, your script should create a file called .protect inside the directory you want to watch. You will use this file to check for any changes made as listed above.
In check mode, your script should report any of the changes listed above.
Explanation / Answer
$ ls
someFile writeProtectedFile
$ rm someFile
$ ls
writeProtectedFile
$ rm writeProtectedFile
rm remove write-protected regular file 'writeProtectedFile'? yes
$ ls
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.