Thread: '-U postgres' doesn't authenticate

'-U postgres' doesn't authenticate

From
Derek Fountain
Date:
I'm using PG-7.4.2 on a SUSE-9.1 box. The docs say that I need to be the
'postgres' user in order to do things like create databases, which makes
sense. If I switch to that user (using 'su') it works fine, but if I use
the -U switch from my own Linux account I get an error:

 >createdb -U postgres test
 createdb: could not connect to database template1: FATAL:  IDENT
 authentication failed for user "postgres"

My understanding is that this should work, and it would be a useful shortcut
for me if it did. Do I misunderstand or have SUSE set something in the
config to disable this feature?

Re: '-U postgres' doesn't authenticate

From
Nikki
Date:
In article
<41736ee7$0$25578$5a62ac22@per-qv1-newsreader-01.iinet.net.au>, Derek
Fountain <nospam@example.com> wrote:

> I'm using PG-7.4.2 on a SUSE-9.1 box. The docs say that I need to be the
> 'postgres' user in order to do things like create databases, which makes
> sense. If I switch to that user (using 'su') it works fine, but if I use
> the -U switch from my own Linux account I get an error:
>
>  >createdb -U postgres test
>  createdb: could not connect to database template1: FATAL:  IDENT
>  authentication failed for user "postgres"
>
> My understanding is that this should work, and it would be a useful shortcut
> for me if it did. Do I misunderstand or have SUSE set something in the
> config to disable this feature?

Hi Derek

I'm novice myself, but your experiences sound familiar. I'm the only
one using my system and network, so I'm root, postgres, and cleaning
staff.

1) different distros place the files in differenty. I have postgresql
on an OSX Mac, and on a Debian system - the same files are installed in
quite different places. So you must a) check where 'createdb' and the
other commands are

find / -name createdb

and b) which directory the 'data' is in. It won't be the same.

then include the path in the command, or cd to that directory and issue
the coammand from there. Add the path via your shell. It may be a good
idea to do that AFTER you've created a user (and place the new drectory
in his/her .profile).

2) as 'postgres' you can add users and give them permission to create
dbs and even add more users. You don't actually have to be 'postgres'
for much.  I generally use

su - postgres

otherwise I'm running postgresql from my everyday username, pretty much
as I'd use emacs or anything.

Hope this helps.  Good Luck

Nikki

Re: '-U postgres' doesn't authenticate

From
Bruno Wolff III
Date:
On Mon, Oct 18, 2004 at 15:27:28 +0800,
  Derek Fountain <nospam@example.com> wrote:
> I'm using PG-7.4.2 on a SUSE-9.1 box. The docs say that I need to be the
> 'postgres' user in order to do things like create databases, which makes
> sense. If I switch to that user (using 'su') it works fine, but if I use
> the -U switch from my own Linux account I get an error:
>
>  >createdb -U postgres test
>  createdb: could not connect to database template1: FATAL:  IDENT
>  authentication failed for user "postgres"
>
> My understanding is that this should work, and it would be a useful shortcut
> for me if it did. Do I misunderstand or have SUSE set something in the
> config to disable this feature?

You need to say that it is OK for your linux account to connect as postgres.
You do this by changing pg_ident.conf. I think just doing a SIGHUP after
the change is enough to get the file reread.