🎓 BookMCQ
← Back to 18. The Linux System

📝 Access control in Linux System (16 MCQs)

Controlling User and Process Access to Linux Resources

Linux access control determines which users and processes may perform operations on files, directories, devices, and other resources. Traditional discretionary access control uses ownership, group membership, and read, write, and execute permission bits. Additional mechanisms, including access control lists, Linux capabilities, and security modules, provide more detailed restrictions.

Why User Identity Alone Cannot Define Resource Permissions

Authenticated users require different rights depending on their roles and the resources they use. A system must prevent ordinary accounts from changing protected files or controlling privileged devices while allowing authorised sharing. Linux combines identity information with ownership and policy checks to make access decisions at relevant operations.

Mode Bits, ACLs and Capability Checks

For a file operation, the kernel evaluates the process credentials against the file's owner, group, and permission bits. Access control lists can specify additional user and group entries. Linux capabilities divide selected privileged operations into narrower units, while Linux Security Modules support additional mandatory access policies such as SELinux or AppArmor.

Example of a Restricted Configuration File

A file owned by root has mode 640. The owner can read and write, members of its group can read, and other users receive no permissions. A standard user outside the owning group cannot modify the file, even if the user has successfully logged in.

Least Privilege and Multiple Enforcement Layers

Access control protects sensitive data and limits damage from compromised accounts. ACLs provide finer permissions, capabilities reduce the need for broad root authority, and mandatory access controls add policy boundaries. Incorrect ownership, group membership, or permissive settings can expose resources, so administrators must review permissions and privileged services regularly.

Misconceptions About Linux Access Control

'The root account is restricted by ordinary file mode bits in the same way as a regular user' ignores its traditional discretionary privileges and additional security controls. 'Execute permission means the same thing on files and directories' is false because directory execute permits traversal. 'A successful login grants access to every file' confuses authentication with authorisation.

Exam Focus: Permission Bits, ACLs and Linux Security Modules

Decode octal permissions such as 640 and determine access for owner, group, and others. Explain directory read, write, and execute semantics. Questions may compare DAC, ACLs, capabilities, and mandatory access control or examine how SELinux and AppArmor add restrictions beyond traditional permission bits.

Key Terms of Linux Access Control

  • DAC - Discretionary access control.
  • ACL - Detailed list of resource permissions.
  • Capability - Specific unit of process privilege.
  • SELinux - Linux mandatory access control system.
  • AppArmor - Linux application confinement security module.
3
Easy
8
Medium
5
Hard

📝 All Access control in Linux System MCQs

Q1. What is the primary purpose of the route‑caching table in the IP subsystem?

A.To store wildcard routes for quick lookup ✅
B.To cache specific destination routes for faster retrieval
C.To maintain firewall rule chains
D.To manage fragment reassembly
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The route‑caching table holds only fully resolved routes for individual destination addresses, allowing the IP driver to bypass the more expensive FIB search on subsequent packets. Option A is incorrect because wildcards are deliberately excluded to keep lookups fast. Option C refers to firewall management, not routing. Option D describes fragment handling, which is unrelated to caching. By caching specific routes, the system reduces processing time, improving overall network throughput in real‑world routing scenarios.

Q2. Which firewall chain processes packets that are generated by the local host before they are transmitted?

A.Forwarded chain
B.Input chain
C.Output chain ✅
D.Raw chain
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Packets created by the host travel through the output chain before they are handed to the device driver for transmission. The forwarded chain deals with packets that the router forwards on behalf of other hosts, while the input chain handles packets arriving at the host. The raw chain is not a standard Linux chain for this purpose. Selecting the output chain ensures the host’s own traffic is filtered according to the policies set for outbound traffic.

Q3. Why does the forwarding information base (FIB) search the tables containing the most specific routes before less specific ones?

A.Because specific routes are stored in faster memory
B.To ensure longest‑prefix match and correct forwarding ✅
C.To reduce the number of hash collisions
D.Because wildcard entries are prioritized
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: IP forwarding follows the longest‑prefix rule: the most specific route determines the next hop. By searching the tables with the narrowest prefixes first, the router guarantees that a packet follows the correct path even when broader routes also match the destination. The other options are false: memory speed is not the deciding factor, hash collisions are unrelated, and wildcards are not given priority in the FIB.

Q4. How does the absence of wildcard entries in the route‑caching table improve lookup performance?

A.It reduces the size of the cache, making linear search faster ✅
B.It forces the system to always perform a full FIB search
C.It eliminates the need for pattern matching during cache lookup
D.It enables the use of hardware acceleration for exact matches
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the cache stores only exact destination entries, the lookup becomes a simple key‑value operation without any pattern or wildcard matching, which is computationally cheap. Option A suggests a linear search, but the cache is typically accessed via a hash table. Option B is opposite to the goal of caching, and option D, while plausible, is not the primary reason; the main benefit is the elimination of pattern matching.

Q5. Explain the relationship between an ipfrag object and an ipq structure during IP fragment reassembly.

A.ipfrag objects are temporary buffers for individual fragments, while ipq groups them for a single datagram ✅
B.Each ipfrag represents a complete datagram and ipq stores fragments
C.ipq holds routing information and ipfrag holds firewall rules
D.ipfrag and ipq are unrelated components
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Each incoming fragment is wrapped in an ipfrag object that holds its data and metadata. The ipq structure represents the reassembly queue for a particular original datagram, collecting all ipfrag objects that belong together. The other statements invert the roles or assign unrelated functions, which would prevent proper reconstruction of the original packet. Understanding this pairing is essential for diagnosing reassembly failures in real network environments.

Q6. What effect does a fixed expiration period without hits have on entries in the route‑caching table?

A.Expired entries are permanently removed, causing a permanent loss of routes
B.Expired entries are refreshed automatically by the kernel
C.Expiration has no impact on caching behavior
D.Expired entries are evicted, forcing a new FIB lookup on subsequent packets ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: When a cached entry goes a set amount of time without being used, the kernel discards it to free space and to avoid stale routes. This forces the next packet destined for that address to trigger a full FIB search, rebuilding the cache if needed. The other options either describe permanent deletion (which is not typical), automatic refresh (which does not occur), or no impact (which would defeat the purpose of expiration).

Q7. How does the ordering of rules within a firewall chain influence the final decision for a packet?

A.All matching rules are applied and their decisions are combined
B.The first rule that matches determines the action, and later rules are ignored ✅
C.Rules are evaluated in parallel, and the most restrictive action wins
D.Ordering has no effect; the chain is treated as an unordered set
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Linux netfilter processes each chain sequentially: as soon as a rule matches, its action (accept, drop, etc.) is taken and the remaining rules are not examined. This makes rule order critical; placing a generic drop rule before a specific allow rule will cause the packet to be dropped. The other options describe behaviors that do not exist in the iptables processing model, which relies on first‑match semantics.

Q8. Why does the firewall manager maintain separate chains for forwarded, input, and output packets?

A.Because each direction has distinct security policies and processing requirements ✅
B.To simplify logging by grouping packets by protocol
C.To reduce the number of rules needed overall
D.To enable load balancing across multiple CPUs
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Forwarded, input, and output traffic have different trust levels and policy goals; separating them allows administrators to apply tailored rules—for example, stricter inbound filtering while permitting more liberal outbound traffic. The other choices misstate the purpose: logging can be done per chain but is not the primary reason, rule count is not necessarily reduced, and load balancing is unrelated to chain segmentation.

Q9. A router receives a set of fragments for a datagram but one fragment never arrives. What is the most likely outcome for that datagram?

A.The router will forward the partial datagram to the destination
B.The incomplete fragments will be stored indefinitely
C.The reassembly timer will expire and the fragments will be discarded ✅
D.The router will request retransmission from the source
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: IP reassembly uses a timer; if any fragment is missing when the timer expires, the partially assembled datagram is discarded to avoid delivering corrupted data. Routers do not request retransmission, as that is handled by higher‑level protocols. Keeping fragments indefinitely would waste resources, and forwarding an incomplete packet would violate protocol integrity. Discarding the fragments protects the network from delivering malformed payloads.

Q10. A 4500‑byte payload must be sent over a link with an MTU of 1500 bytes and a 20‑byte IP header. How many fragments are required?

A.2
B.3
C.4 ✅
D.5
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: Each fragment can carry at most 1500−20=14801500-20 = 1480 bytes of payload. The number of fragments needed is ⌈4500/1480⌉=⌈3.04⌉=4\lceil 4500 / 1480 \rceil = \lceil 3.04 \rceil = 4. Therefore four fragments will be generated, each with a 20‑byte header and up to 1480 bytes of data, except the last fragment which may carry less. The other answer choices underestimate or overestimate the required count.

Q11. An administrator configures the input chain to drop all UDP traffic while the output chain allows UDP. Which of the following packets will be permitted through the host?

A.Incoming UDP packet from the network
B.Outgoing UDP packet generated by the host ✅
C.Both incoming and outgoing UDP packets
D.Neither incoming nor outgoing UDP packets
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The input chain applies to packets arriving at the host, so any inbound UDP packet will be dropped. The output chain applies to packets the host sends, and it has been configured to allow UDP, so outbound UDP traffic will pass. Hence only the outgoing UDP packet is permitted. The other options either assume both directions are allowed or both are blocked, which contradicts the specific chain configurations.

Q12. If a route‑caching entry expires after 30 seconds without hits, what is the impact on traffic that experiences a 10‑second idle period followed by a sudden burst of packets?

A.The entry will be kept permanently, improving performance
B.The entry will be removed before the burst, causing a full FIB lookup for each packet in the burst
C.The entry will survive the idle period and be reused for the burst ✅
D.The expiration timer resets after each packet, so the entry never expires
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Since the idle interval (10 s) is shorter than the 30‑second expiration threshold, the cached entry remains valid. When the burst arrives, the router can reuse the existing cache entry, avoiding costly FIB lookups for each packet. If the idle time had exceeded 30 s, the entry would have been evicted and a full lookup would be required. The other statements misrepresent how expiration timers work.

Q13. A firewall rule that matches a specific source IP is placed after a generic rule that drops all traffic. What will be the result for packets from that source IP?

A.They will be allowed because the specific rule overrides the generic one
B.They will be dropped because the generic rule is evaluated first ✅
C.They will be logged but still forwarded
D.They will trigger an alert but be processed normally
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Netfilter evaluates rules sequentially; the first matching rule determines the action. Because the generic drop rule appears before the specific allow rule, packets from the source IP will match the drop rule and be discarded, never reaching the later allow rule. The other options assume later rules can override earlier ones or that additional logging/alerting occurs, which is not the case in the standard rule‑processing model.

Q14. An attacker sends overlapping IP fragments to exploit reassembly vulnerabilities. Which design feature of the IP driver helps mitigate this attack?

A.The use of a fixed‑size route cache
B.Discarding fragments that do not match an existing ipq or have inconsistent offsets ✅
C.Caching firewall decisions for each fragment
D.Allowing unlimited fragment reassembly time
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The IP driver validates each incoming fragment against the reassembly queue (ipq) and checks that offsets and lengths are consistent. Overlapping or inconsistent fragments are rejected, preventing the attacker from crafting malicious payloads. A fixed‑size route cache does not address fragment attacks, nor does caching firewall decisions per fragment. Allowing unlimited reassembly time would actually increase exposure to such attacks, not mitigate them.

Q15. The FIB contains a /24 table and a /16 table. For a packet destined to 192.168.1.5, which table is consulted first?

A./16 table
B./24 table ✅
C.Both tables simultaneously
D.Neither table; the packet is sent to the default route
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The /24 entry represents a more specific prefix (255.255.255.0) than the /16 entry (255.255.0.0). According to longest‑prefix match rules, the router examines the table with the narrowest mask first, so it will look in the /24 table before considering the broader /16 table. The other options describe incorrect lookup orders or fallback behavior that does not apply when a specific route exists.

Q16. A host receives an IP fragment whose offset value is not a multiple of 8 bytes. According to the IP specification, how does the driver handle this fragment?

A.It adjusts the offset to the nearest multiple of 8
B.It accepts the fragment and reassembles it normally
C.It discards the fragment as malformed ✅
D.It forwards the fragment to the next hop unchanged
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The fragment offset field is defined in 8‑byte units; any value not aligned to an 8‑byte boundary violates the IP standard. The driver therefore treats the fragment as malformed and discards it to preserve packet integrity. Adjusting the offset would corrupt the data, and forwarding or accepting it would break reassembly expectations. Discarding ensures that only correctly formatted fragments contribute to the reconstructed datagram.

🔗 Related Topics (MCQs)