Re: [GENERAL] .pgpass not working

2012-05-08 Thread Rebecca Clarke
Hi Ben

I had saved the .pgpass file in my home directory /home/user/.pgpass which
works when I'm logged in as user. However, in order for me to use Slony, I
had to be logged in as postgres user.
I installed strace and ran my pg_dump test and found that it actually looks
for the .pgpass file in /var/lib/postgresql  (which I'm assuming is the
postgres users home directory as this is the directory where I begin in
when I log in).
I made a copy of the .pgpass and saved it in that location and it worked!

Many thanks.

Rebecca

On Fri, May 4, 2012 at 6:35 PM, Ben Chobot be...@silentmedia.com wrote:

 On May 4, 2012, at 9:30 AM, Rebecca Clarke wrote:

 I do not want to touch the pg_hba.conf so I have generated the .pgpass
 file.
 The permissions is set to 600, and I have correctly inputted the details
 into .pgpass, there are no leading spaces.

 *myhostname:myport:*:postgres:mypassword*

 However I am still prompted for a password.
 I have tested pg_dump as well and it prompts also.

 Does anyone have any suggestions on what may be the culprit. Is there
 somewhere I need to specify to tell the system to look into the .pgpass
 file?


 Where is the .pgpass file? If it's not in ~/.pgpass or doesn't have the
 right ownership (your permissions are good) then it won't be used. If it's
 in a different location, you might need to make use of the PGPASSFILE
 environment variable.

 If you really get stuck, you can always strace psql or pg_dump and see if
 it has problems opening your .pgpass file.



[GENERAL] .pgpass not working

2012-05-04 Thread Rebecca Clarke
Hi

Apologies in advance if this is the wrong place to ask.

I have Postres 8.4 and I am setting up replication with Slony.
I'm having password issues with slony.
I have roamed the net for a solution and the way to fix it is to use the
.pgpass file or change pg_hba.conf to accept trusted connections.
I do not want to touch the pg_hba.conf so I have generated the .pgpass file.
The permissions is set to 600, and I have correctly inputted the details
into .pgpass, there are no leading spaces.

*myhostname:myport:*:postgres:mypassword*

However I am still prompted for a password.
I have tested pg_dump as well and it prompts also.

Does anyone have any suggestions on what may be the culprit. Is there
somewhere I need to specify to tell the system to look into the .pgpass
file?

many thanks

rebecca


Re: [GENERAL] .pgpass not working

2012-05-04 Thread Tom Lane
Rebecca Clarke r.clark...@gmail.com writes:
 I'm having password issues with slony.
 I have roamed the net for a solution and the way to fix it is to use the
 .pgpass file or change pg_hba.conf to accept trusted connections.
 I do not want to touch the pg_hba.conf so I have generated the .pgpass file.

Reasonable.

 The permissions is set to 600, and I have correctly inputted the details
 into .pgpass, there are no leading spaces.

 *myhostname:myport:*:postgres:mypassword*

 However I am still prompted for a password.
 I have tested pg_dump as well and it prompts also.

Hmm, you're not showing exactly how you're trying to connect, but it
might be that you need localhost in the first field rather than the
real machine name.  If that's not it, I'd suggest you show us the actual
file contents (you can blank out the password) and the actual pg_dump
command you're trying.

regards, tom lane

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] .pgpass not working

2012-05-04 Thread Ben Chobot
On May 4, 2012, at 9:30 AM, Rebecca Clarke wrote:

 I do not want to touch the pg_hba.conf so I have generated the .pgpass file.
 The permissions is set to 600, and I have correctly inputted the details into 
 .pgpass, there are no leading spaces.
 
 myhostname:myport:*:postgres:mypassword
 
 However I am still prompted for a password.
 I have tested pg_dump as well and it prompts also.
 
 Does anyone have any suggestions on what may be the culprit. Is there 
 somewhere I need to specify to tell the system to look into the .pgpass file?

Where is the .pgpass file? If it's not in ~/.pgpass or doesn't have the right 
ownership (your permissions are good) then it won't be used. If it's in a 
different location, you might need to make use of the PGPASSFILE environment 
variable.

If you really get stuck, you can always strace psql or pg_dump and see if it 
has problems opening your .pgpass file. 

[GENERAL] .pgpass not working?

2011-04-08 Thread Yang Zhang
I'm using the postgresql 8.4.7 in Ubuntu 10.04, and I'm trying to use
.pgpass documented here:

http://www.postgresql.org/docs/8.4/interactive/libpq-pgpass.html

I have a ~/.pgpass with 600 perms containing:

myhostname.com:yang:yang:mypassword

However, it doesn't seem to get picked up by psql -h myhostname.com.
I also tried explicitly specifying PGPASSFILE, but that didn't work.
Neither that env var nor .pgpass is documented in man psql.

Entering my password manually works, however.  (Don't need to specify
username/database since they default to my username, which is also
yang.)

Also tried connecting with psycopg2 via sqlalchemy (connect string
postgresql://myhostname.com/yang), and it also didn't auto pick up
.pgpass.

Any hints on what's up?  Thanks in advance.

Yang

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] .pgpass not working?

2011-04-08 Thread Yang Zhang
Dah, left out the port.

On Fri, Apr 8, 2011 at 10:36 PM, Yang Zhang yanghates...@gmail.com wrote:
 I'm using the postgresql 8.4.7 in Ubuntu 10.04, and I'm trying to use
 .pgpass documented here:

 http://www.postgresql.org/docs/8.4/interactive/libpq-pgpass.html

 I have a ~/.pgpass with 600 perms containing:

 myhostname.com:yang:yang:mypassword

 However, it doesn't seem to get picked up by psql -h myhostname.com.
 I also tried explicitly specifying PGPASSFILE, but that didn't work.
 Neither that env var nor .pgpass is documented in man psql.

 Entering my password manually works, however.  (Don't need to specify
 username/database since they default to my username, which is also
 yang.)

 Also tried connecting with psycopg2 via sqlalchemy (connect string
 postgresql://myhostname.com/yang), and it also didn't auto pick up
 .pgpass.

 Any hints on what's up?  Thanks in advance.

 Yang




-- 
Yang Zhang
http://yz.mit.edu/

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general