1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 20. Client Authentication</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="runtime-config-short.html" title="19.18. Short Options" /><link rel="next" href="auth-pg-hba-conf.html" title="20.1. The pg_hba.conf File" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 20. Client Authentication</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="runtime-config-short.html" title="19.18. Short Options">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><th width="60%" align="center">Part III. Server Administration</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="auth-pg-hba-conf.html" title="20.1. The pg_hba.conf File">Next</a></td></tr></table><hr /></div><div class="chapter" id="CLIENT-AUTHENTICATION"><div class="titlepage"><div><div><h2 class="title">Chapter 20. Client Authentication</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="auth-pg-hba-conf.html">20.1. The <code class="filename">pg_hba.conf</code> File</a></span></dt><dt><span class="sect1"><a href="auth-username-maps.html">20.2. User Name Maps</a></span></dt><dt><span class="sect1"><a href="auth-methods.html">20.3. Authentication Methods</a></span></dt><dt><span class="sect1"><a href="auth-trust.html">20.4. Trust Authentication</a></span></dt><dt><span class="sect1"><a href="auth-password.html">20.5. Password Authentication</a></span></dt><dt><span class="sect1"><a href="gssapi-auth.html">20.6. GSSAPI Authentication</a></span></dt><dt><span class="sect1"><a href="sspi-auth.html">20.7. SSPI Authentication</a></span></dt><dt><span class="sect1"><a href="auth-ident.html">20.8. Ident Authentication</a></span></dt><dt><span class="sect1"><a href="auth-peer.html">20.9. Peer Authentication</a></span></dt><dt><span class="sect1"><a href="auth-ldap.html">20.10. LDAP Authentication</a></span></dt><dt><span class="sect1"><a href="auth-radius.html">20.11. RADIUS Authentication</a></span></dt><dt><span class="sect1"><a href="auth-cert.html">20.12. Certificate Authentication</a></span></dt><dt><span class="sect1"><a href="auth-pam.html">20.13. PAM Authentication</a></span></dt><dt><span class="sect1"><a href="auth-bsd.html">20.14. BSD Authentication</a></span></dt><dt><span class="sect1"><a href="auth-oauth.html">20.15. OAuth Authorization/Authentication</a></span></dt><dt><span class="sect1"><a href="client-authentication-problems.html">20.16. Authentication Problems</a></span></dt></dl></div><a id="id-1.6.7.2" class="indexterm"></a><p>
3 When a client application connects to the database server, it
4 specifies which <span class="productname">PostgreSQL</span> database user name it
5 wants to connect as, much the same way one logs into a Unix computer
6 as a particular user. Within the SQL environment the active database
7 user name determines access privileges to database objects — see
8 <a class="xref" href="user-manag.html" title="Chapter 21. Database Roles">Chapter 21</a> for more information. Therefore, it is
9 essential to restrict which database users can connect.
10 </p><div class="note"><h3 class="title">Note</h3><p>
11 As explained in <a class="xref" href="user-manag.html" title="Chapter 21. Database Roles">Chapter 21</a>,
12 <span class="productname">PostgreSQL</span> actually does privilege
13 management in terms of <span class="quote">“<span class="quote">roles</span>”</span>. In this chapter, we
14 consistently use <em class="firstterm">database user</em> to mean <span class="quote">“<span class="quote">role with the
15 <code class="literal">LOGIN</code> privilege</span>”</span>.
17 <em class="firstterm">Authentication</em> is the process by which the
18 database server establishes the identity of the client, and by
19 extension determines whether the client application (or the user
20 who runs the client application) is permitted to connect with the
21 database user name that was requested.
23 <span class="productname">PostgreSQL</span> offers a number of different
24 client authentication methods. The method used to authenticate a
25 particular client connection can be selected on the basis of
26 (client) host address, database, and user.
28 <span class="productname">PostgreSQL</span> database user names are logically
29 separate from user names of the operating system in which the server
30 runs. If all the users of a particular server also have accounts on
31 the server's machine, it makes sense to assign database user names
32 that match their operating system user names. However, a server that
33 accepts remote connections might have many database users who have no local
35 account, and in such cases there need be no connection between
36 database user names and OS user names.
37 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="runtime-config-short.html" title="19.18. Short Options">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="admin.html" title="Part III. Server Administration">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="auth-pg-hba-conf.html" title="20.1. The pg_hba.conf File">Next</a></td></tr><tr><td width="40%" align="left" valign="top">19.18. Short Options </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 20.1. The <code class="filename">pg_hba.conf</code> File</td></tr></table></div></body></html>