CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 2 of 7 · 2 min read

Authentication

Think of entering a building. A guard may ask for something you know (a code), something you have (a card) or something you are (a face). One of the three can be stolen, guessed or copied, and two together are much harder. The analogy stops in one place: a guard can look at your face, while a computer sees only the data that arrives.

In plain words: Authentication is the act of checking that a user is who they claim to be. The evidence is of three kinds: something the user knows (a password), something the user has (a hardware key, a phone) and something the user is (a fingerprint). Using two kinds is called two-factor authentication. The kernel does not check passwords itself. A program such as login or sshd does the check, and if it succeeds, the program sets the user and group IDs of the new process (page 2) and runs the user's shell. From then on the kernel trusts those numbers.

A worked example (made up to show the idea). A password is guessed by an attacker with probability 1 in 1,000 (it is weak). A second factor, a one-time code from a phone, is guessed with probability 1 in 1,000,000 within its few seconds of life. An attacker who wants both must be right twice, so the chance per attempt is 1/1,000 x 1/1,000,000 = 1 in 10^9, a million times smaller than for the password alone, and the stolen password helps little without the phone.

The key lines. Authentication answers "who?". The permission checks of page 2 answer "may this user do that?", which is authorization. A system can be strong in one and weak in the other.

Authentication

Authentication is the process of verifying the identity that a user or program claims, by checking evidence such as a secret the user knows, an object the user has, or a feature of the user. It differs from authorization, which decides what an authenticated identity may do.

Example: a login program compares the hash of a typed password with the stored hash, and on a match starts a shell with the user's IDs.

Check yourself: 1. Name the three kinds of evidence. 2. What is the difference between authentication and authorization? 3. Why does a second factor help when a password is stolen?