📝 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.
📝 All Access control in Linux System MCQs
Q1. What is the primary purpose of the route‑caching table in the IP subsystem?
📖 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?
📖 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?
📖 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?
📖 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.
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 Explanation: Each fragment can carry at most bytes of payload. The number of fragments needed is . 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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.