Database Reference
In-Depth Information
You may also need the following:
SELECT version();
See also
There are many other snippets of information required to understand connections. Some of
those are mentioned in this chapter, although others are discussed in the chapter on Security .
For further details, please consult the PostgreSQL server documentation.
Enabling access for network/remote users
PostgreSQL comes in a variety of distributions. In many of these, you will find that remote
access is initially disabled as a security measure.
How to do it...
F Add/edit the following line in your postgresql.conf :
listen_addresses = '*'
F Add the following line as the first line of pg_hba.conf , to allow access to all
databases for all users with an encrypted password:
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host
all
all 0.0.0.0/0 md5
How it works...
The listen_addresses parameter specifies on which IP addresses to listen. This allows
you to have more than one network card (NICs) per system. In most cases, we want to accept
connections on all NICs, so we use "*", meaning "all IP addresses".
The pg_hba.conf contains a set of host-based authentication rules. Each rule is considered
in sequence until one rule fires, or the attempt is specifically rejected with a reject method.
The preceding rule means a remote connection that specifies any user, or any database, on
any IP address will be asked to authenticate using an md5 encrypted password.
Type = host means a remote connection.
Database = all means "for all databases". Other names match exactly, except when
prefixed with a plus (+) symbol, in which case we mean a "group role" rather than a single
user. You can also specify a comma-separated list of users, or use the @ symbol to include
a file with a list of users. You can also specify "sameuser", so that the rule matches when we
specify the same name for the username and database name.
 
Search WWH ::




Custom Search