Thread: Problem with .pgpass

Problem with .pgpass

From
Nicolas Michel
Date:
Hi here,

I'm trying to make my dump script working but it is not.

I tried to put my password in a .pgpass file into the home directory of the root user (so /root/.pgpass). Here is a cat of that file :
*:*:*:*:test

(I tried only with stars to be sure my rule was not too strict).

So, il I try this command :
root@pc:~ # psql -h localhost -U postgres
I get :
psql: FATAL:  authentification par mot de passe échouée pour l'utilisateur  « postgres »
(this is in french but it means that the password authentication method failed for the user 'postgres')

If I rename my .pgpass into .pgpass.old, I can log in to postgres with the same command :
root@pc:~ # psql -h localhost -U postgres
When prompt for a password, I enter 'test' and it's working ...

Someone understand where's the problem?

Re: Problem with .pgpass

From
Tom Lane
Date:
Nicolas Michel <nicolas.michel@lemail.be> writes:
> I tried to put my password in a .pgpass file into the home directory of
> the root user (so /root/.pgpass). Here is a cat of that file :
> *:*:*:*:test

> (I tried only with stars to be sure my rule was not too strict).

> So, il I try this command :

>         root@pc:~ # psql -h localhost -U postgres

> I get :

>         psql: FATAL:  authentification par mot de passe échouée pour
>         l'utilisateur  « postgres »

If it is not prompting you for a password then it must have successfully
gotten a password out of the file (and then failed because it's the
wrong password).  I'm guessing the problem is something silly like extra
trailing space on the line with the password.

            regards, tom lane

Re: Problem with .pgpass

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> I tried to put my password in a .pgpass file into the home directory of
> the root user (so /root/.pgpass). Here is a cat of that file :
> *:*:*:*:test
>
>        psql: FATAL:  authentification par mot de passe choue pour
...
> When prompt for a password, I enter 'test' and it's working ...

It certainly seems as though it *should* work, based on the information
you gave us. Try making a new line above it with a more specific entry:
perhaps there are some weird character issues with the current line.

*:*:*:postgres:test
*:*:*:*:test

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation
PGP Key: 0x14964AC8 200905181203
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAkoRhugACgkQvJuQZxSWSsiOgwCeLi7o3fbXu9CX61PQqfcPI0/g
LjcAoOJoo29McOt0Xirf7n/5VJ80pJbG
=qhRT
-----END PGP SIGNATURE-----



Re: Problem with .pgpass

From
Scott Mead
Date:


> I tried to put my password in a .pgpass file into the home directory of
> the root user (so /root/.pgpass). Here is a cat of that file :
> *:*:*:*:test
>
>        psql: FATAL:  authentification par mot de passe choue pour
...
> When prompt for a password, I enter 'test' and it's working ...


  Does the file have permissions of 600?

--Scott

Re: Problem with .pgpass

From
Nicolas Michel
Date:
There was indeed a blank after the line (after the password)... ^^
To Scott : yes, I set the file with 0600 permissions ;)

Thank you very much for your help.


Le lundi 18 mai 2009 à 11:59 -0400, Tom Lane a écrit :
Nicolas Michel <nicolas.michel@lemail.be> writes:
> I tried to put my password in a .pgpass file into the home directory of
> the root user (so /root/.pgpass). Here is a cat of that file :
> *:*:*:*:test

> (I tried only with stars to be sure my rule was not too strict).

> So, il I try this command :

>         root@pc:~ # psql -h localhost -U postgres

> I get :

>         psql: FATAL:  authentification par mot de passe échouée pour
>         l'utilisateur  « postgres »

If it is not prompting you for a password then it must have successfully
gotten a password out of the file (and then failed because it's the
wrong password).  I'm guessing the problem is something silly like extra
trailing space on the line with the password.
		regards, tom lane