Question

Write a bash script to protect a directory. Your script should notify a user of the...

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
A)
$ ls
someFile writeProtectedFile
$ rm someFile
$ ls
writeProtectedFile
$ rm writeProtectedFile
rm remove write-protected regular file 'writeProtectedFile'? yes
$ ls
Add a comment
Know the answer?
Add Answer to:
Write a bash script to protect a directory. Your script should notify a user of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need a bash script that prompts the user for a filename within a directory, and...

    I need a bash script that prompts the user for a filename within a directory, and if the file/subdirectory exists to gzip them. Directories should be tarred and zipped, files should just be gzipped. This should poll inside of a loop to keep prompting the user until the user ends the script.

  • Problem 4: Write a Bash script that removes all zero length ordinary files in the directory...

    Problem 4: Write a Bash script that removes all zero length ordinary files in the directory (including those in the sub-directories at all levels) passed as an optional argument. If you do not specify the directory argument, the script uses the current working directory as the default argument. This problem is for practicing bash programming skills. Though there is an easier way to achieve the goal with the find command, the find command is not allowed to appear in your...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

  • Write a bash shell script, deleteFilesWithZeroLength.sh, that removes all zero length ordinary files in the directory passed as an optional argument. If you do not specify the directory argument, the script uses the present working directory as the defaul

    Write a bash shell script, deleteFilesWithZeroLength.sh, that removes all zero length ordinary files in the directory passed as an optional argument. If you do not specify the directory argument, the script uses the present working directory as the default argument. Do appropriate exception handling in your script such as:If the arguments are more than 1, print out “Too many arguments passed”.If the argument passed is a regular file, print out “XXX is regular file”.1c. If the directory doesn’t exist, print out “Directory...

  • Create a bash script to do the following on your CentOS6 VM. To back up your...

    Create a bash script to do the following on your CentOS6 VM. To back up your home folder using tar command daily. Use gzip as the compression for tar (z option). – 10pts Hint: Make sure you exclude the tar file itself from the backup. The script should name the tar file backupYYYYMMDD.tar.gz -10 pts The script should keep the last seven days of backup files and delete backup files older than seven days. -10 pts The script should check...

  • Write a bash script to find all the files ending with .c recursively for every directory...

    Write a bash script to find all the files ending with .c recursively for every directory in your current working directory, then copy each one to a folder called programs, need handle duplicates by appending the number to the end of the file (ex main.c main-1.c ) compile them and generate a report report should look like: main.c compiles prog2.c failed main-2.c compiles etc.

  • Write a bash shell script to carry out each of the following tasks: What to Do:...

    Write a bash shell script to carry out each of the following tasks: What to Do: a. Safe Delete: When you use the “rm” command in Linux, it will delete the specified files, with no chance for recovering them back later. Write a script (called srm) that will safely delete the files passed to it as command-line arguments. For example, typing the command: “srm file1 file2 file3”, the script shall not actually delete these files, but instead it shall move...

  • (In Linux) 1. Create a file to write to from your script and save it as...

    (In Linux) 1. Create a file to write to from your script and save it as “.txt”. 2. Write the following information to the file that you created in Step 1: Today's date Your full name Your student ID The name of your course What directory you are in File permissions of the file that you created that allow everyone to read, write, and execute The long list of files in your current directory, providing all items and their process...

  • Objective : Write a C Shell script which copies all files(*.java and *.class) from your home dire...

    Objective : Write a C Shell script which copies all files(*.java and *.class) from your home directory to a new one, and Analyze the new directory information such as number of files, user permissions, and disk usage. Sample Output:                                                    << CS Directory Analysis >>      Date:   ============================================================ Current Directory: /home/tomss New Directory Created : /home/tomss/pgm01 File information Total Number of files : 22 files Directory files:   0 files Plain text files:   10 files File have read permissions: 3 files File have...

  • using lubuntu ce the following activities on your Linux virtual machine. Then complete estions. Write a script file which when executed will perform the following: First display today's date in d...

    using lubuntu ce the following activities on your Linux virtual machine. Then complete estions. Write a script file which when executed will perform the following: First display today's date in dd.mm.YYYY format (e.g. 20.04.2019). Ask user to enter a name to create a directory. Create a directory by the given directory name above. . . Ask user to enter a name to create a file. Copy the file /etc/passwd to the given filename above inside the newly created directory Copy...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT