Linux Permissions 3 — Questions and Answers
Question 1: What octal value sets the setuid bit along with rwxr-xr-x permissions?
- 4755 (Correct answer)
- 2755
- 1755
- 6755
Correct answer: 4755
The setuid bit is represented by the leading 4 in octal, so 4755 means setuid + rwxr-xr-x.
Question 2: A user runs ls -l and sees -rwsr-xr-x on /usr/bin/passwd. What does the 's' in the owner execute position indicate?
- The setuid bit is set and the file is executable (Correct answer)
- The file is a symbolic link
- The setgid bit is set
- The sticky bit is active
Correct answer: The setuid bit is set and the file is executable
A lowercase 's' in the owner's execute position means the setuid bit is set and the owner execute bit is also set.
Question 3: Which command recursively changes permissions for all files and directories under /var/www to 755?
- chmod -R 755 /var/www (Correct answer)
- chmod -r 755 /var/www
- chown -R 755 /var/www
- chmod 755 -all /var/www
Correct answer: chmod -R 755 /var/www
The -R flag in chmod applies the permission change recursively to all files and subdirectories.
Question 4: What does ACL stand for in the context of Linux file permissions?
- Access Control List (Correct answer)
- Advanced Command Layer
- Application Control Logic
- Attribute Control Level
Correct answer: Access Control List
ACL stands for Access Control List, which allows more granular permission assignments beyond the traditional owner/group/other model.
Question 5: Which command is used to view the ACL entries on a file?
- getfacl file.txt (Correct answer)
- lsacl file.txt
- chmod -l file.txt
- stat --acl file.txt
Correct answer: getfacl file.txt
The `getfacl` command displays the access control list entries for a file or directory.
Question 6: A file is owned by user 'alice' and group 'staff'. User 'bob' is in the 'staff' group. The file has permissions rw-r-----. Can bob read the file?
- Yes, because bob is in the staff group which has read permission (Correct answer)
- No, because bob is not the owner
- Yes, because others have no permission which defaults to group
- No, because the file has no world-readable bits
Correct answer: Yes, because bob is in the staff group which has read permission
Bob belongs to the 'staff' group, which has read (r--) permission, so he can read the file.
Question 7: What permission mode does chmod 000 set on a file?
- Removes all read, write, and execute permissions for everyone (Correct answer)
- Sets full permissions for owner only
- Makes the file hidden
- Locks the file so only root can access it
Correct answer: Removes all read, write, and execute permissions for everyone
chmod 000 removes all permissions from owner, group, and others, making the file inaccessible to everyone except root.
What octal value sets the setuid bit along with rwxr-xr-x permissions?