PostgreSQL OpenSource Database

3 Authentication / Authorization

2.6 Tips, Useful Stuff & Quickies [  up  ] - [ TOC ] - [ A - Z ] 4 PostgreSQL Interfaces

For convenience, the programs createuser and dropuser are provided as wrappers around these SQL commands that can be called from the shell command line:

createuser name
dropuser name

createuser --pwprompt --no-createdb --no-adduser <username>

SQL-based user creation

postgres=# CREATE USER <username> WITH PASSWORD 'secret';

Host-based Authentication with pg_hba.conf

If you want to authorize a connection from a host 211.222.123.321 you had to add the following line to your pg_hba.conf:

host    all         all         211.222.123.321         255.255.255.255   trust

Please take note this is a truly generous way for an auhorization from this host. You might consider a more restrictive fashion. See the outcommented samples within the file.

After customizing pg_hba.conf you had at least to reload the PostgreSQL DBMS:

pg_ctl reload


Related Links





copyright by reto - created with mytexi
$Id: authen.html,v 1.30 2007/03/07 08:41:03 webcms Exp $