🎓 BookMCQ
← Back to 18. The Linux System

📝 Authentication in Linux System (10 MCQs)

Verifying User Identity During Linux Login

Linux authentication verifies the identity of users or services before granting access to sessions and protected resources. Login programs and applications commonly use Pluggable Authentication Modules, or PAM, to apply configured authentication rules. Account information, password verifiers, group membership, and security policies contribute to the process, while the kernel enforces permissions after a session is established.

Why Identity Verification Must Be Separate from Permissions

A username identifies an account but does not prove that the person requesting access controls its credentials. Linux therefore verifies passwords or other configured factors before establishing a user session. Authentication alone does not define every permitted operation; file permissions, groups, capabilities, and mandatory access controls determine subsequent authorisation.

PAM, Password Verification and User Identity

A login service invokes PAM according to its configured service rules. The authentication module verifies the supplied credential using the account's protected password verifier, commonly stored in /etc/shadow when local shadow passwords are used. Successful authentication allows the service to establish a session with the appropriate UID, GID, and supplementary groups.

Example of a Local Linux Login

A user enters the account name sara and supplies a password at a login prompt. The login service invokes its PAM stack, which checks the credential against the configured authentication source. If verification succeeds, the session starts with Sara's user and group identifiers and the configured login environment.

Authentication Modules and Account Protection

PAM supports flexible authentication, account checks, password changes, and session setup across different services. Password hashes, access restrictions, multi-factor modules, and login monitoring strengthen protection. Misconfigured PAM rules may block legitimate logins or weaken controls, while compromised credentials can still be misused after successful verification.

Misconceptions About Linux Authentication

'/etc/shadow stores ordinary readable passwords' is false because it stores protected password verifier data and account fields. 'PAM is the kernel scheduler for logins' is incorrect because it is a user-space authentication framework. 'Authentication grants administrator privileges automatically' ignores UID, groups, sudo policy, and other authorisation checks.

Exam Focus: PAM and Linux Account Credentials

Explain the roles of PAM, /etc/passwd, /etc/shadow, UID, GID, and supplementary groups. Trace a successful login from credential verification to session creation. Questions may distinguish authentication from authorisation or examine how PAM modules provide different login policies for system services.

Key Terms of Linux Authentication

  • PAM - Framework for pluggable authentication modules.
  • /etc/shadow - Stores protected local password verifier data.
  • UID - Numeric user identifier.
  • GID - Numeric group identifier.
  • Authentication - Verification of a claimed identity.
2
Easy
5
Medium
3
Hard

📝 All Authentication in Linux System MCQs

Q1. A system administrator wants to allow SSH connections (port 22) only from the trusted IP 192.168.1.10. Which firewall chain ordering will correctly enforce this rule without exposing the SSH service to other hosts?

A.Place the allow rule in the INPUT chain after a generic deny‑all rule.
B.Place the allow rule in the INPUT chain before the generic deny‑all rule. ✅
C.Place the allow rule in the FORWARD chain before any other rules.
D.Place the allow rule in the OUTPUT chain.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The correct answer is B because placing the allow rule before the generic deny‑all rule ensures the packet matches the specific permit condition first, so the SSH connection from 192.168.1.10 is accepted. Option A would never be reached because the deny‑all rule blocks the packet earlier. Option C applies to forwarded traffic, not locally‑destined packets, so it would not affect SSH input. Option D affects outbound traffic, which is irrelevant for incoming SSH. By ordering the rule correctly, the firewall enforces authentication by limiting access to the trusted host.

Q2. If a route‑caching entry for destination 10.0.0.5 expires after a period with no hits, what is the most likely effect on an authentication server that relies on that route for client connections?

A.Clients will receive faster responses because the cache is cleared. ✅
B.The server will drop all incoming packets from that destination.
C.Authentication will be bypassed due to missing route information.
D.Increased latency as each new packet requires a full FIB lookup before reaching the server.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the cached route for 10.0.0.5 expires, the IP layer must perform a full FIB lookup for each new packet. This adds latency before the packet reaches the authentication server, potentially causing time‑outs for clients expecting quick responses. Option A suggests faster delivery, which is incorrect because the route must be recomputed. Option B claims the server will drop packets, which is not true; packets are still forwarded after the lookup. Option C mentions a security breach, which is unrelated to caching. Option D correctly identifies increased latency due to the extra lookup.

Q3. Why does the route cache store only exact destinations and never wildcard entries?

A.Because each cached entry must map one address to a single next‑hop for O(1) retrieval.
B.Because wildcard entries exceed kernel memory limits. ✅
C.Because wildcards are illegal in Linux routing tables.
D.Because storing wildcards would create security vulnerabilities.
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The cache stores exact destinations because wildcard entries would match many destinations, defeating the purpose of quick look‑ups; each cached entry must map one address to a single next‑hop, guaranteeing O(1) retrieval. Option B suggests memory limits, which is not the primary reason. Option C claims wildcards are illegal, which is false. Option D states wildcards cause security holes, which is not accurate. By caching only specific routes, the system ensures deterministic performance and avoids ambiguous matches.

Q4. How does IP fragmentation impact the ability to authenticate the integrity of a packet?

A.Each fragment is independently authenticated, so integrity is checked per fragment. ✅
B.Fragmentation improves authentication by spreading checksums across fragments.
C.Authentication can only be performed after all fragments are reassembled and the payload checksum is verified.
D.Fragmentation automatically bypasses authentication mechanisms.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Fragmentation splits a large packet into smaller pieces, each carrying its own header but sharing the original payload checksum. The receiver must reassemble the fragments before verifying the end‑to‑end integrity checksum, so authentication can only be performed after reassembly. Option A says each fragment is independently authenticated, which is incorrect because the checksum covers the whole payload. Option B claims fragmentation improves authentication, which is misleading. Option D suggests authentication is bypassed, which is not true if reassembly is done correctly. Therefore, proper reassembly is essential for reliable authentication.

Q5. During reassembly, which step ensures that a fragmented packet has not been tampered with before authentication?

A.Verifying the payload checksum of the reconstructed packet after all fragments arrive.
B.Checking the MAC address of each individual fragment. ✅
C.Applying TLS verification to each fragment separately.
D.Discarding fragments that exceed a predefined size limit.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The IP driver computes the header checksum for each fragment and, after all fragments arrive, verifies the payload checksum of the reconstructed packet. This final checksum verification guarantees that no bits were altered during transmission. Option B suggests checking the MAC address of each fragment, which is not part of IP reassembly. Option C mentions using TLS, which operates above IP and is unrelated to fragment handling. Option D proposes discarding fragments based on size, which does not address integrity. Thus, the checksum step is the decisive safeguard.

Q6. An administrator notices that overlapping rules in the INPUT and FORWARD chains allow unauthenticated traffic to reach a protected service. Which configuration change most effectively closes the bypass?

A.Add a deny‑all rule to the OUTPUT chain. ✅
B.Reorder the existing rules in the INPUT chain only.
C.Place a deny‑all rule at the top of both INPUT and FORWARD chains.
D.Disable the FORWARD chain entirely.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Moving the deny‑all rule to the top of both INPUT and FORWARD chains ensures that any packet not explicitly permitted is dropped before it can be forwarded, eliminating the overlap that creates the bypass. Option A, adding a rule to the OUTPUT chain, does not affect inbound traffic. Option B, changing the rule order in only one chain, leaves the other chain vulnerable. Option D, disabling the FORWARD chain, would stop all forwarded traffic but also break legitimate routing. Therefore, placing a top‑level deny rule in both chains is the safest fix.

Q7. Why does separating firewall rules into distinct INPUT, OUTPUT, and FORWARD chains improve authentication enforcement?

A.It reduces the overall processing time for each packet. ✅
B.It allows policies to be applied based on packet direction, preventing rules from unintentionally permitting traffic in the wrong direction.
C.It simplifies the routing tables used by the kernel.
D.It eliminates the need for network address translation.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Distinct chains allow policies to be applied based on the packet’s direction relative to the host, so authentication checks can be tailored for inbound, outbound, and transit traffic. This separation prevents a rule intended for one direction from unintentionally permitting traffic in another direction. Option A claims it reduces processing time, which is a secondary effect. Option C suggests it simplifies routing tables, which is unrelated. Option D states it eliminates the need for NAT, which is false. By isolating rule sets, administrators can enforce authentication consistently and avoid accidental rule interactions.

Q8. An attacker sends overlapping IP fragments designed to confuse the reassembly process and inject malicious code that bypasses authentication. Which mitigation provides the strongest protection?

A.Encrypt each fragment separately before transmission. ✅
B.Increase the route‑cache timeout to keep entries longer.
C.Disable the firewall entirely to allow all traffic.
D.Enforce strict fragment reassembly policies that reject overlapping fragments and require the final fragment before processing.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Enforcing strict fragment reassembly policies—such as rejecting overlapping fragments, limiting the number of fragments per packet, and requiring the final fragment before processing—prevents the attacker from exploiting reassembly ambiguities. Option A, encrypting each fragment separately, is impractical and does not address reassembly logic. Option B, increasing the route‑cache timeout, does not affect fragment handling. Option C, disabling the firewall, would remove security altogether. Therefore, robust fragment validation is the most effective defense against this type of bypass.

Q9. In Linux networking, what does the term 'skbuff' refer to?

A.A socket buffer that holds packet data and metadata within the kernel.
B.A security key used for authentication protocols. ✅
C.A routing table entry that maps destinations to next hops.
D.A user‑space socket used by applications to send data.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The term 'skbuff' stands for socket buffer, a kernel data structure that holds packet data and associated metadata as it moves through the network stack. Option B incorrectly defines it as a security key. Option C describes a routing table entry, which is unrelated. Option D suggests it is a user‑space socket, which is not accurate. Understanding that skbuff represents the packet container is essential for grasping how firewall and fragmentation modules manipulate network traffic.

Q10. How does a fixed expiration period for route‑cache entries influence authentication latency when routes change frequently?

A.It speeds up authentication by keeping entries permanently cached. ✅
B.It has no effect on authentication latency because caching only affects routing.
C.It adds processing delay because each new packet must trigger a fresh FIB lookup after the cache entry expires.
D.It improves security by automatically discarding stale routes, which directly reduces authentication time.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A fixed expiration forces the cache to discard entries after a set idle time, so when a route changes, the next packet triggers a fresh FIB lookup, adding processing delay before the packet reaches the authentication service. Option A claims it speeds up authentication, which is false because stale entries must be refreshed. Option B suggests it has no effect, ignoring the extra lookup time. Option D states it improves security, which is indirect. Therefore, the timeout introduces latency proportional to the cache refresh interval, impacting time‑sensitive authentication.)

🔗 Related Topics (MCQs)