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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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 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(dot)Elphick(at)lfix(dot)co(dot)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

In response to

Browse pgsql-novice by date

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