010-160 File Permissions and Ownership 2 — Questions and Answers
Question 1: What numeric permission value represents rwxr-x---?
- 750 (Correct answer)
- 755
- 740
- 760
Correct answer: 750
rwx=7, r-x=5, ---=0, so the octal value is 750.
Question 2: Which command changes the group ownership of a file to 'devs'?
- chgrp devs file.txt
- chown :devs file.txt
- chown devs file.txt
- Both A and B (Correct answer)
Correct answer: Both A and B
Both 'chgrp devs file.txt' and 'chown :devs file.txt' change only the group ownership.
Question 3: A file has permissions -rw-rw-r--. Which class has write access?
- Owner and group (Correct answer)
- Owner only
- Group and others
- All classes
Correct answer: Owner and group
rw- for owner and rw- for group means both owner and group have write access; others have read-only.
Question 4: What does the sticky bit do when set on a directory?
- Prevents users from deleting files they do not own (Correct answer)
- Makes the directory immutable
- Runs files as the directory owner
- Prevents new files from being created
Correct answer: Prevents users from deleting files they do not own
The sticky bit on a directory restricts file deletion so only the file owner, directory owner, or root can remove files.
Question 5: Which symbolic permission argument adds execute permission for all users?
- a+x (Correct answer)
- u+x
- o+x
- g+x
Correct answer: a+x
'a' stands for all (user, group, others), so 'a+x' adds execute for everyone.
Question 6: What is the default umask value for a regular user on most Linux systems?
- 0022 (Correct answer)
- 0002
- 0044
- 0077
Correct answer: 0022
The default umask for regular users is typically 0022, resulting in files with 644 and directories with 755.
Question 7: A file is owned by user 'alice' and group 'staff'. The current user is 'bob', who is in the 'staff' group. The file permissions are rw-r--r--. Can bob write to the file?
- No, bob can only read it via group permissions (Correct answer)
- Yes, because he is in the staff group
- Yes, because others have read permission
- No, the file is locked
Correct answer: No, bob can only read it via group permissions
The group permission is r-- (read-only), so bob, matched as a group member, can only read the file.
What numeric permission value represents rwxr-x---?