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

Login to your UNIX account and follow all the steps in Chapter 33 of the textboo

ID: 3762000 • Letter: L

Question

Login to your UNIX account and follow all the steps in Chapter 33 of the textbook.

Perform exercises 3–11 from section 33.20 (p. 409–410) of the textbook, and include your answers (shell scripts in most cases) and results in the report.

3. Read about the chmod utility in Chapter 6. Suppose you have a text file named myfile. Write the commands you would use to accomplish the following:

a. Make myfile executable (but not readable or writable) by everyone.

b. Allow the owner to read, write, or execute myfi le; allow the group to read or execute the file; allow everyone else to execute the file only.

c. Add write permissions for members of the group.

d. Remove all permissions from everyone. (Why might you want to do this?)

4. Write a shell script named chnoex that reverses the effects of chex by removing the execution permissions on a file.

5. Write a shell script named private that uses chmod to change the access permissions on a file so that only the owner may read, write, or execute it. Be sure to label the output to show what was done to the file.

6. Write a shell script named public that reverses the effect of the private script you wrote in the previous exercise.

7. Modify the de l script so that it detects whether the user has specified a directory to be deleted, in which case the script should call the rmdi r command. (Hint: use test with the -d option to test for a directory.)

8. The calendar utility will remind you of important events. One limitation of calendar is that you have to enter each event individually, along with its date. This can be a problem for routine events that happen every day or every week. For reminding yourself of such events, write a script named tickle that can be run from your shell startup file when you log in. Have the script run the date utility to determine the day of the week. Use a case structure to select the appropriate message for each day of the week.

9. Rewrite tickle to use an if/then/elif ... /fi structure.

10. The standard echo command echoes its arguments just once. Write a script echo. by that echoes its arguments as many times as the user chooses. For example, if the user enters the command line §echo.by 5 Play it again, Sam.(Return) 410 CHAPTER 33: SHELL SCRIPTING the script should print Play it again, Sam. Play it again, Sam. Play it again, Sam. Play it again, Sam. Play it again, Sam. (Hint: Use awhile loop.)

11. Rewrite echo. by to using an until loop.

Explanation / Answer

a)
chmod a+r bla.txt

b)
Read, write, execute   commad:rwx

c)

sudo usermod -a -G www-data <some_user>

d)

-rw-rw-r--
The first column shows current permissions; it has ten slots. The first slot represents the type of file. The remaining nine slots are actually three sets of permissions for three different categories of users.

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