Re: Major newbie - Mailing list pgsql-novice

From Oliver Elphick
Subject Re: Major newbie
Date
Msg-id 1014667197.5761.13.camel@linda
Whole thread Raw
In response to Major newbie  ("David J. Lines" <dlines@principia.edu>)
List 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 127.0.0.1' 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; 127.0.0.1 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 127.0.0.1' 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
privileges.)

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
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


pgsql-novice by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: Tried to upgrade from 7.1.3 to 7.2 --Fatal Error
Next
From: Dave Peticolas
Date:
Subject: A question about functions and transactions.