PostgreSQL

Скачать в pdf «PostgreSQL»


The ident entry also takes an optional argument that specifies a special map name to map ident user names to database user names. The file data/pg_ident.conf records these mappings.


Examples


Local entries are configured on per-database hosts. A database entry of all applies to all databases. In data/pg_hba.eonf, the lines


local    all    trust


host    all    127.0.0.1    255.255.255.25S trust


cause all local users to be trusted. The first line affects users connecting via Unix domain sockets; the second line controls local users connecting to the same machine by tcp/ip. The local machine is accessed as tcp/ip address 127.0.0.1 {localhost}.


Both host and hostssl entries require the additional specification of host addresses and network masks. The lines


host    all    192.168.34.0    255.255.255.255    crypt


host    all    192.168.90.0    255.255.255.0    password


force all users from host 192.168.34.0 and network 192.168.90.0 to provide passwords. Crypt encrypts the passwords that are sent; password sends passwords over the network without encryption. The line


host    all    192.168.98.0    255.255.255.255    password    finance


is similar to the previous entries, except that it uses the user names/passwords stored in finance to authenticate users.


The lines


host    sales    192.168.7.12    255.255.255.255    ident


host    sales    192.168.7.64    255.255.255.255    ident support


use ident on the remote machine to verify the users connecting to database sales from the hosts 192.168.7.12 and 192.168.7.64. The second entry uses the support user name mapping in data/pg_-ident.conf.


Connections from hosts and networks not appearing in the file are rejected. For more information, see the file data/pg_hba.conf and the Administrator’s Guide discussed in Appendix
A.2.


For database client applications, the environment variables PGHOST, PGPORT, PGUSER, PGPASS-word, pgdatestyle, pgtz, pgclientencoding, and pgdatabase are helpful for setting default connection parameters and options. The PostgreSQL documentation provides more information about them.

Скачать в pdf «PostgreSQL»