Skip to content

Commit f6bc986

Browse files
committed
Refinements
1 parent 714384a commit f6bc986

File tree

1 file changed

+71
-118
lines changed

1 file changed

+71
-118
lines changed

doc/src/sgml/ref/pg_passwd.sgml

Lines changed: 71 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,106 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pg_passwd.sgml,v 1.3 2000/07/21 00:24:37 momjian Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/ref/Attic/pg_passwd.sgml,v 1.4 2000/11/18 19:05:58 petere Exp $
33
Postgres documentation
44
-->
55

66
<refentry id="APP-PG-PASSWD">
7+
<docinfo>
8+
<date>2000-11-18</date>
9+
</docinfo>
10+
711
<refmeta>
8-
<refentrytitle id="APP-PG-PASSWD-TITLE">
9-
<application>pg_passwd</application>
10-
</refentrytitle>
12+
<refentrytitle id="APP-PG-PASSWD-TITLE"><application>pg_passwd</application></refentrytitle>
13+
<manvolnum>1</manvolnum>
1114
<refmiscinfo>Application</refmiscinfo>
1215
</refmeta>
16+
1317
<refnamediv>
14-
<refname>
15-
<application>pg_passwd</application>
16-
</refname>
17-
<refpurpose>
18-
Manipulate the flat password file
19-
</refpurpose>
18+
<refname>pg_passwd</refname>
19+
<refpurpose>Manipulate a text password file</refpurpose>
2020
</refnamediv>
21+
2122
<refsynopsisdiv>
22-
<refsynopsisdivinfo>
23-
<date>1999-07-20</date>
24-
</refsynopsisdivinfo>
25-
<synopsis>
26-
pg_passwd <replaceable class="parameter">filename</replaceable>
27-
</synopsis>
23+
<cmdsynopsis>
24+
<command>pg_passwd</command>
25+
<arg choice="plain"><replaceable>filename</replaceable></arg>
26+
</cmdsynopsis>
2827
</refsynopsisdiv>
2928

30-
<refsect1 id="R1-APP-PG-PASSWD-1">
31-
<refsect1info>
32-
<date>1999-07-20</date>
33-
</refsect1info>
34-
<title>
35-
Description
36-
</title>
29+
<refsect1 id="app-pg-passwd-description">
30+
<title>Description</title>
3731
<para>
38-
<application>pg_passwd</application>
39-
is a tool to manipulate the
40-
flat password file functionality of
41-
<productname>Postgres</productname>. This style of password
42-
authentication is not <emphasis>required</emphasis> in an
43-
installation, but is one of several supported security mechanisms.
32+
<application>pg_passwd</application> is a tool to manipulate a flat
33+
text password file for the purpose of using that file to control
34+
the client authentication of the
35+
<productname>PostgreSQL</productname> server. More information
36+
about setting up this authentication mechanism can be found in the
37+
<citetitle>Administrator's Guide</citetitle>.
4438
</para>
4539

4640
<para>
47-
Specify the password file in the same style of
48-
<literal>Ident</literal> authentication in
49-
<filename>$PGDATA/pg_hba.conf</filename>:
50-
51-
<programlisting>
52-
host unv 133.65.96.250 255.255.255.255 password passwd
53-
</programlisting>
54-
55-
where the above line allows access from 133.65.96.250 using the passwords listed
56-
in <filename>$PGDATA/passwd</filename>.
57-
The format of the password file follows those of
58-
<filename>/etc/passwd</filename>
59-
and
60-
<filename>/etc/shadow</filename>.
61-
The first field is the user name, and the second field
62-
is the encrypted password.
63-
The rest is completely ignored.
64-
Thus the following three sample lines specify the same user and password pair:
65-
66-
<programlisting>
67-
pg_guest:/nB7.w5Auq.BY:10031::::::
68-
pg_guest:/nB7.w5Auq.BY:93001:930::/home/guest:/bin/tcsh
69-
pg_guest:/nB7.w5Auq.BY:93001
70-
</programlisting>
41+
The form of a text password file is one entry per line; the fields
42+
of each entry are separated by colons. The first field is the user
43+
name, the second field is the encrypted password. Other fields are
44+
ignored (to allow password files to be shared between applications
45+
that use similar formats). The functionality of the
46+
<application>pg_passwd</application> utility is to enable a user to
47+
interactively add entries to such a file, to alter passwords of
48+
existing entries, and to take care of encrypting the passwords.
7149
</para>
7250

7351
<para>
74-
Supply the password file to the pg_passwd command.
75-
In the case described above, after changing the working directory to
76-
<envar>PGDATA</envar>, the following command execution specifies
77-
the new password for <literal>pg_guest</literal>:
78-
79-
<programlisting>
80-
$ pg_passwd passwd
81-
Username: pg_guest
82-
Password:
83-
Re-enter password:
84-
</programlisting>
85-
86-
where the <literal>Password:</literal>
87-
and <literal>Re-enter password:</literal>
88-
prompts require the same password input which are not displayed
89-
on the terminal.
90-
The original password file is renamed to
91-
<filename>passwd.bk</filename>.
52+
Supply the name of the password file as argument to the pg_passwd
53+
command. To be of use for client authentication the file needs to
54+
be location in the server's data directory, and the base name of
55+
the file needs to be specified in the
56+
<filename>pg_hba.conf</filename> access control file.
57+
58+
<screen>
59+
<prompt>$</prompt> <userinput>pg_passwd /usr/local/pgsql/data/passwords</userinput>
60+
<computeroutput>File "/usr/local/pgsql/data/passwords" does not exist. Create? (y/n):</computeroutput> <userinput>y</userinput>
61+
<prompt>Username:</prompt> <userinput>guest</userinput>
62+
<prompt>Password:</prompt>
63+
<prompt>Re-enter password:</prompt>
64+
</screen>
65+
66+
where the <literal>Password:</literal> and <literal>Re-enter
67+
password:</literal> prompts require the same password input which
68+
is not displayed on the terminal.
9269
</para>
9370

9471
<para>
95-
<application>psql</application>
96-
uses the <option>-u</option>
97-
option to invoke this style of
98-
authentication.
72+
The original password file is renamed to
73+
<filename>passwords.bk</filename>.
9974
</para>
10075

10176
<para>
102-
The following lines show the sample usage of the option:
77+
To make use of this password file, put a line like the following in
78+
<filename>pg_hba.conf</filename>:
10379

10480
<programlisting>
105-
$ psql -h hyalos -u unv
106-
Username: pg_guest
107-
Password:
108-
Welcome to the POSTGRESQL interactive sql monitor:
109-
Please read the file COPYRIGHT for copyright terms of POSTGRESQL
110-
type \? for help on slash commands
111-
type \q to quit
112-
type \g or terminate with semicolon to execute query
113-
You are currently connected to the database: unv
114-
unv=>
115-
</programlisting>
116-
</para>
117-
118-
<para>
119-
Perl5 authentication
120-
uses the new style of the <filename>Pg.pm</filename> like this:
81+
host unv 133.65.96.250 255.255.255.255 password passwords
82+
</programlisting>
12183

122-
<programlisting>
123-
$conn = Pg::connectdb("host=hyalos dbname=unv
124-
user=pg_guest password=xxxxxxx");
125-
</programlisting>
126-
127-
For more details, refer to
128-
<filename>src/interfaces/perl5/Pg.pm</filename>.
84+
which would allow access from host 133.65.96.250 using the
85+
passwords listed in the <filename>passwords</filename> file (and
86+
only to the users listed in the file).
12987
</para>
13088

131-
<para>
132-
Pg{tcl,tk}sh authentication
133-
uses the
134-
<function>pg_connect</function>
135-
command with the
136-
<option>-conninfo</option>
137-
option thusly:
138-
139-
<programlisting>
140-
% set conn [pg_connect -conninfo \\
141-
"host=hyalos dbname=unv \\
142-
user=pg_guest password=xxxxxxx "]
143-
</programlisting>
144-
145-
You can list all of the keys for the option by executing the following
146-
command:
89+
<note>
90+
<para>
91+
It is also useful to have entries in password file with an empty
92+
password field. (This is different from an empty password.)
93+
These entries cannot be managed by
94+
<application>pg_passwd</application>, but it is always possible to
95+
edit password files manually.
96+
</para>
97+
</note>
98+
</refsect1>
14799

148-
<programlisting>
149-
% puts [ pg_conndefaults]
150-
</programlisting>
100+
<refsect1 id="app-pg-passwd-seealso">
101+
<title>See also</title>
102+
<para>
103+
<citetitle>PostgreSQL Administrator's Guide</citetitle>
151104
</para>
152105
</refsect1>
153106
</refentry>

0 commit comments

Comments
 (0)