Starting from:

$30

CECS326- Homework 22 Solved

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.

3)  Modify the protections of your home directory with chmod 711 ~

4)  Add getuid and geteuid calls to the front of your code. Print the two numbers.

Now do the following two tests with a partner.

5)  Have the partner run your program ~yourlogin/copy.out It should fail.

6)  Change the mode of your copy.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.

More products