Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
libpq-pgpass.html45 linesDownload Raw Back to html
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>34.16. The Password File</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="libpq-envars.html" title="34.15. Environment Variables" /><link rel="next" href="libpq-pgservice.html" title="34.17. The Connection Service 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">34.16. The Password File</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="libpq-envars.html" title="34.15. Environment Variables">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="libpq.html" title="Chapter 34. libpq — C Library">Up</a></td><th width="60%" align="center">Chapter 34. <span class="application">libpq</span> — C Library</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="libpq-pgservice.html" title="34.17. The Connection Service File">Next</a></td></tr></table><hr /></div><div class="sect1" id="LIBPQ-PGPASS"><div class="titlepage"><div><div><h2 class="title" style="clear: both">34.16. The Password File <a href="#LIBPQ-PGPASS" class="id_link">#</a></h2></div></div></div><a id="id-1.7.3.23.2" class="indexterm"></a><a id="id-1.7.3.23.3" class="indexterm"></a><p>3   The file <code class="filename">.pgpass</code> in a user's home directory can4   contain passwords to5   be used if the connection requires a password (and no password has been6   specified otherwise). On Microsoft Windows the file is named7   <code class="filename">%APPDATA%\postgresql\pgpass.conf</code> (where8   <code class="filename">%APPDATA%</code> refers to the Application Data subdirectory in9   the user's profile).10   Alternatively, the password file to use can be specified11   using the connection parameter <a class="xref" href="libpq-connect.html#LIBPQ-CONNECT-PASSFILE">passfile</a>12   or the environment variable <code class="envar">PGPASSFILE</code>.13  </p><p>14   This file should contain lines of the following format:15</p><pre class="synopsis">16<em class="replaceable"><code>hostname</code></em>:<em class="replaceable"><code>port</code></em>:<em class="replaceable"><code>database</code></em>:<em class="replaceable"><code>username</code></em>:<em class="replaceable"><code>password</code></em>17</pre><p>18   (You can add a reminder comment to the file by copying the line above and19   preceding it with <code class="literal">#</code>.)20   Each of the first four fields can be a literal value, or21   <code class="literal">*</code>, which matches anything.  The password field from22   the first line that matches the current connection parameters will be23   used.  (Therefore, put more-specific entries first when you are using24   wildcards.) If an entry needs to contain <code class="literal">:</code> or25   <code class="literal">\</code>, escape this character with <code class="literal">\</code>.26   The host name field is matched to the <code class="literal">host</code> connection27   parameter if that is specified, otherwise to28   the <code class="literal">hostaddr</code> parameter if that is specified; if neither29   are given then the host name <code class="literal">localhost</code> is searched for.30   The host name <code class="literal">localhost</code> is also searched for when31   the connection is a Unix-domain socket connection and32   the <code class="literal">host</code> parameter33   matches <span class="application">libpq</span>'s default socket directory path.34   In a standby server, a database field of <code class="literal">replication</code>35   matches streaming replication connections made to the primary server.36   The database field is of limited usefulness otherwise, because users have37   the same password for all databases in the same cluster.38  </p><p>39   On Unix systems, the permissions on a password file must40   disallow any access to world or group; achieve this by a command such as41   <code class="command">chmod 0600 ~/.pgpass</code>.  If the permissions are less42   strict than this, the file will be ignored.  On Microsoft Windows, it43   is assumed that the file is stored in a directory that is secure, so44   no special permissions check is made.45  </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="libpq-envars.html" title="34.15. Environment Variables">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="libpq.html" title="Chapter 34. libpq — C Library">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="libpq-pgservice.html" title="34.17. The Connection Service File">Next</a></td></tr><tr><td width="40%" align="left" valign="top">34.15. Environment Variables </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 34.17. The Connection Service File</td></tr></table></div></body></html>
codekingpro/portable-devtools · Team Ai