Re: Authorise root as postgres - Mailing list pgsql-general

From * Tong *
Subject Re: Authorise root as postgres
Date
Msg-id 3DD9940C.1020305@none
Whole thread Raw
In response to Re: Authorise root as postgres  (Bruno Wolff III <bruno@wolff.to>)
Responses Re: Authorise root as postgres  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-general
Thank you for the reply.

Bruno Wolff III wrote:
>>How can I authorise root the same previliage as postgres?
>>
>>My postgres is password protected, I want to use 'psql -U postgres' as a
>>root without specifying password every time, or for a certain group of
>
> If you are using postgres through a socket (and hence must be on the
> same machine as the server), running at least postgresql 7.2 and your
> OS supports getpeerid, then you can use ident authentication and
> permit root to connect as the postgres user without using a password.

All the anwsers should be yes, except that I don't know about getpeerid.
I'm using RH8, BTW.

Here is what I've been trying (postgresql 7.2 that comes along with RH8):

In $PGDATA/pg_hba.conf, add:

# TYPE       DATABASE    IP_ADDRESS    MASK        AUTH_T    AUTH_ARG
   local      template1                    ident

printf 'admins\troot\tpostgres\n' >> $PGDATA/pg_ident.conf
killall -HUP postmaster

It will still ask for password when 'psql template1' as root. Besides,
specifying either root password or postgres password won't work.

What is supposed to be the right way?

PS. the following works. So I guess it is not the problem of ident:

# TYPE       DATABASE    IP_ADDRESS    MASK               AUTH_T  AUTH_ARG
   local      sameuser                                     ident   sameuser


pgsql-general by date:

Previous
From: Thomas Beutin
Date:
Subject: Re: Query optimization question
Next
From: "David Wall"
Date:
Subject: VARCHAR truncation