Operating Systems and Systems Integration Tutorial: File Permissions 1 Background For the background information you need to answer these questions, please refer to Module 5, Basic Filesystems, in the Linux Training workshop notes. 2 Questions 1. A system administrator lists information about files in the current directory: $ ls -l -rw-rw-rw-rw-rw-r--rw-r--r--rw-r-----rw-------r--------------------r-----------r-- 1 1 1 1 1 1 1 1 1 jimmy jenny jasmine jacob julian jacky jill juliet jeremy students staff jasmine students staff students students students students 5185 5191 2785 25920 13465 736 179665 13840 8418 Feb Oct Oct Oct Oct Oct Oct Feb Oct 17 7 15 15 15 15 15 17 12 08:18 17:21 11:58 11:58 11:58 11:58 11:58 08:18 2001 file1.txt file2.txt file3.txt file4.txt file5.txt file6.txt file7.txt file8.txt file9.txt For each file, say which user(s) has(have): (a) read access? (b) write access? (c) no access? 2. For each of the permissions (i.e., the first column only) in question 1, write a umask value that will result in all files created by the user having the default permission shown. 3. For each of the permissions in question 1, write a chmod command to change the permission using a: (a) numeric mode, (b) symbolic mode. Your answer should work regardless of the permissions that existed previously. Questions are continued on the next page . . . Nick Urbanik ver. 1.3 Tutorial: File Permissions Operating Systems and Systems Integration 2 4. A directory has the following permissions: $ ls -ld directory drwxrwxr-x 1 jimmy students 376 Feb 17 08:18 file1.txt The following users are members of the following groups: user jimmy nicku andy jenny primary group jimmy nicku andy jenny secondary groups project year2 csa staff laboratory students year2 csa students year3 csa For each of the four users, (a) Can he/she create a file in the directory? (b) If the user can create a file, i. who is the owner of the file? ii. which group owns the file? iii. If the umask is 002, what are the file permissions on a file created in that directory? iv. Which of the other users above can: A. read the file? B. write to the file? C. delete the file? 5. Now the sgid (set group id) permission is added to the directory shown in question 4. (a) Write a command to add this permission, leaving other permissions unchanged. (b) Write the permissions on the directory as they would be shown as the first field of the output of ls -ld directory (c) Answer the questions from question 4 for each user again, but write “unchanged” where the result is the same, but where the result is different, explain how. 6. Now the restricted deletion flag (or “sticky bit”) permission is added to the directory shown in question 4, as well as the sgid permission. (a) Write a command to add this permission, leaving other permissions unchanged. (b) Write the permissions on the directory as they would be shown as the first field of the output of ls -ld directory (c) Answer the questions from question 4 for each user again, but write “unchanged” where the result is the same, but where the result is different, explain how. Nick Urbanik ver. 1.3