[SOLVED] CECS326   Homework 22 

30.00 $

Category:

Description

5/5 - (1 vote)

Purpose: This assignment provides experience with the Unix protection mechanisms.

You will need a partner for the last part of this assignment.

Make a copy of homework 2 copy.c called copy2.c.

1) Remove the use of argv[2], the destination file name should always be xfer.tmp in your home directory

(To determine your home directory use pwd.) Make sure you start the path name with a / 2) Compile the program, test it from your account.

  • Modify the protections of your home directory with chmod 711 ~
  • Add getuid and geteuid calls to the front of your code. Print the two numbers.

Now do the following two tests with a partner.

  • Have the partner run your program ~yourlogin/copy.out It should fail.
  • Change the mode of your out to 4711 Have your partner run the program again. It should work.

Demo: The Instructor would like to see a demo of the last 2 tests. Make sure to test them first before the demo.