By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(Knowledge, Possession, Inherence, Location)
Authentication factors are the keys to your kingdom—they determine who (or what) gets access to your systems. In CompTIA Security+, you’ll see these broken into four categories: - Knowledge (something you know) - Possession (something you have) - Inherence (something you are) - Location (somewhere you are)
Why this matters in production: - If you rely only on passwords (Knowledge), a single breach (e.g., phishing, credential stuffing) can compromise your entire system. - If you ignore Location-based auth, an attacker in a different country can brute-force their way in. - If you don’t enforce multi-factor authentication (MFA), you’re one leaked password away from a disaster.
Real-world scenario: You’re a sysadmin at a healthcare company. A doctor’s laptop is stolen. If you only used a password (Knowledge), the thief now has access to patient records. But if you required a YubiKey (Possession) + fingerprint (Inherence) + being on-site (Location), the thief is locked out—even if they crack the password.
passwd -n 90 -x 30 -w 7 -i 14 user1
aws iam enable-mfa-device --user-name alice --serial-number arn:aws:iam::123456789012:mfa/alice --authentication-code1 123456 --authentication-code2 789012
bash aws ec2 authorize-security-group-ingress \ --group-id sg-12345678 \ --protocol tcp \ --port 22 \ --cidr 192.168.1.0/24
Prerequisites: - AWS account with IAM admin permissions. - A TOTP app (Google Authenticator, Authy) or hardware MFA device (YubiKey).
aws iam create-user --user-name alice aws iam create-login-profile --user-name alice --password-reset-required --password "TempPass123!"
Verification: - Log in to AWS Console as alice with the temp password. - You’ll be forced to change it (Knowledge factor enforced).
alice
aws iam enable-mfa-device \ --user-name alice \ --serial-number arn:aws:iam::123456789012:mfa/alice \ --authentication-code1 123456 \ --authentication-code2 789012
How to get the codes:1. Open your TOTP app (e.g., Google Authenticator).2. Scan the QR code from AWS Console (or enter the secret key manually).3. Enter two consecutive codes when prompted.
Verification: - Log out and try logging in again. - After entering the password, AWS will ask for an MFA code.
Create an IAM policy requiring MFA for sensitive actions (e.g., deleting S3 buckets):
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Deny", "Action": "s3:DeleteBucket", "Resource": "*", "Condition": { "BoolIfExists": { "aws:MultiFactorAuthPresent": false } } } ] }
Attach this policy to alice:
aws iam put-user-policy --user-name alice --policy-name EnforceMFA --policy-document file://mfa-policy.json
Verification: - Try deleting an S3 bucket without MFA-Access Denied. - Try again with MFA-Success.
Enforce MFA everywhere (AWS, GitHub, VPN, SSH). ? Use hardware tokens (YubiKey, Titan) for admins (SMS/email 2FA is phishable). ? Rotate TOTP secrets (e.g., every 6 months) if using app-based MFA. ? Block logins from high-risk countries (e.g., AWS GuardDuty + IAM policies).
Use free TOTP apps (Google Authenticator, Authy) instead of SMS (carrier fees). ? Hardware tokens are a one-time cost (~$20–$50) vs. recurring SMS charges.
Have backup MFA methods (e.g., YubiKey + TOTP app). ? Document MFA recovery procedures (e.g., "If YubiKey is lost, use backup codes"). ? Test MFA enrollment in staging before rolling out to production.
Monitor MFA failures (e.g., AWS CloudTrail logs for ConsoleLogin events with MFAUsed: false). ? Set alerts for unusual login locations (e.g., "User logged in from Russia, but they’re in the US").
ConsoleLogin
MFAUsed: false
AdministratorAccess
Possession (something you have).
"What’s the most secure MFA method?"
SMS (vulnerable to SIM swapping).
"Why is location-based auth alone insufficient?"
"A company wants to secure remote access to its AWS console. Which combination of factors provides the strongest security?" --Password (Knowledge) + YubiKey (Possession) + IP Whitelisting (Location). --Password + SMS (SMS is phishable).
Task: Configure SSH key + TOTP MFA for a Linux server (Knowledge + Possession).
Solution:1. Install Google Authenticator PAM module: bash sudo apt install libpam-google-authenticator2. Edit /etc/pam.d/sshd and add: auth required pam_google_authenticator.so3. Edit /etc/ssh/sshd_config and set: ChallengeResponseAuthentication yes AuthenticationMethods publickey,keyboard-interactive4. Restart SSH: bash sudo systemctl restart sshd5. Run google-authenticator as the user and scan the QR code in your TOTP app.
bash sudo apt install libpam-google-authenticator
/etc/pam.d/sshd
auth required pam_google_authenticator.so
/etc/ssh/sshd_config
ChallengeResponseAuthentication yes AuthenticationMethods publickey,keyboard-interactive
bash sudo systemctl restart sshd
google-authenticator
Why it works: - SSH requires both a private key (Possession) and a TOTP code (Knowledge).
AWS CLI MFA Commands:
aws iam enable-mfa-device --user-name alice --serial-number arn:aws:iam::123456789012:mfa/alice --authentication-code1 123456 --authentication-code2 789012 aws iam list-mfa-devices --user-name alice
Linux PAM MFA:
sudo apt install libpam-google-authenticator google-authenticator # Run as user
Authentication factors are not just theory—they’re your first line of defense in production. Always combine at least two factors (e.g., Knowledge + Possession) and monitor for anomalies (e.g., logins from unexpected locations).
Now go enforce MFA on your AWS root account—before someone else does. ?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.