Bird
0
0

If the pg_hba.conf file has this line: host all all 10.0.0.0/8 scram-sha-256, what will happen when a user connects from 10.1.2.3 with an MD5 password?

medium📝 query result Q5 of 15
PostgreSQL - Roles and Security
If the pg_hba.conf file has this line: host all all 10.0.0.0/8 scram-sha-256, what will happen when a user connects from 10.1.2.3 with an MD5 password?
AConnection succeeds using MD5 password
BConnection succeeds without password
CConnection fails because SCRAM is required
DConnection fails due to IP mismatch
Step-by-Step Solution
Solution:
  1. Step 1: Check IP and authentication method

    IP 10.1.2.3 is within 10.0.0.0/8, so SCRAM-SHA-256 authentication applies.
  2. Step 2: Understand password method mismatch

    User provides MD5 password, but SCRAM requires SCRAM authentication, so connection fails.
  3. Final Answer:

    Connection fails because SCRAM is required -> Option C
  4. Quick Check:

    SCRAM required, MD5 password fails [OK]
Quick Trick: SCRAM method rejects MD5 passwords [OK]
Common Mistakes:
  • Assuming MD5 password works with SCRAM
  • Thinking connection succeeds without password
  • Ignoring IP range

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes