Skip site navigation (1) Skip section navigation (2)

Re: Major newbie

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: "David J(dot) Lines" <dlines(at)principia(dot)edu>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Major newbie
Date: 2002-02-25 19:59:56
Message-ID: 1014667197.5761.13.camel@linda (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Mon, 2002-02-25 at 16:38, David J. Lines wrote:
> Hi,
> I am very new to PostgreSQL and PERL.  I am trying to fix up a system that
> has no passwords on the PostgreSQL system by adding passwords.
> 1.  What is the difference between the 'local' entry in the pg_hba.conf
> file and the 'host' entry?

local uses Unix sockets to connect from another process on the same
machine.  This does not use TCP/IP.

host <address> uses a TCP/IP connection; is localhost, but the
same rules apply to any IP address listed in pg_hba.conf.

> 2.  Can I add passwords partially to the system?

You can make different entries in pg_hba.conf for different types of
connection.  In 7.2 you can use ident on a local connection in
conjunction with a pg_ident map to allow more extensive access to a
particular user without the need of entering a password.

> 3.  If I get passwords added, is there some way to specify the passwords on
> the 'pgsql' command line without adding the -u switch and specifying (at
> the prompt) the user name and the password?

PGUSER=your_id PGPASSWORD=your_password psql ...

> 4.  Is a PERL script file coming into the database by the entry (in
> pg_hba.conf file) as 'local' or as 'host' entry?

That depends on whether or not it specifies a host in its connection
call.  If it does not specify a host at all, it will use local; if it
specifies a host, even localhost, it will use host.

> 5.  How do I add passwords on the database open in the PERL script file so
> that the password is specified in the program?

Set PGPASSWORD in the environment?  

(On many O/S, the environment can be read by ps, so setting PGPASSWORD
would open your passwords to view by anyone with the necessary

Oliver Elphick                                Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight                    
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "Peace I leave with you, my peace I give unto you; not 
      as the world giveth, give I unto you. Let not your 
      heart be troubled, neither let it be afraid."         
                                John 14:27 

In response to

pgsql-novice by date

Next:From: RobDate: 2002-02-25 20:03:10
Subject: Dates in postgres
Previous:From: Oliver ElphickDate: 2002-02-25 19:50:23
Subject: Re: Tried to upgrade from 7.1.3 to 7.2 --Fatal Error

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group