Обсуждение: .pgpass file
I have configured a .pgpass file, but am having trouble with the hostname portion. If I have robux:*:JED:jed:jed or local:*:JED:jed:jed and I do "psql -U jed" I get the password prompt. If I use *:*:JED:jed:jed then I do not and it logs in correctly (which is what I want). I would prefer not to have the hostname as * and only allow use of the password file if it's a local connection, but how do I get it to recognize the hostname? (FYI - on my linux box "uname -n" and "echo $HOSTNAME" are both robux) Thanks, Jed S. Walker
On Mon, Mar 21, 2005 at 01:47:43PM -0700, Walker, Jed S wrote: > I have configured a .pgpass file, but am having trouble with the hostname > portion. > > If I have > > robux:*:JED:jed:jed > or > local:*:JED:jed:jed > > and I do "psql -U jed" I get the password prompt. What happens if you put "localhost" instead of "local" in .pgpass? Or if you run "psql -h robux -U jed"? See also the comments about environment variables in the psql documentation and the "Environment Variables" section of the libpq documentation. You can set up your environment so all you have to type is "psql". -- Michael Fuhr http://www.fuhr.org/~mfuhr/
Then it works!! Thanks. Now, how do I verify from within psql what the username I'm logged in as is? -----Original Message----- From: Michael Fuhr [mailto:mike@fuhr.org] Sent: Monday, March 21, 2005 2:24 PM To: Walker, Jed S Cc: 'pgsql-novice@postgresql.org' Subject: Re: [NOVICE] .pgpass file On Mon, Mar 21, 2005 at 01:47:43PM -0700, Walker, Jed S wrote: > I have configured a .pgpass file, but am having trouble with the hostname > portion. > > If I have > > robux:*:JED:jed:jed > or > local:*:JED:jed:jed > > and I do "psql -U jed" I get the password prompt. What happens if you put "localhost" instead of "local" in .pgpass? Or if you run "psql -h robux -U jed"? See also the comments about environment variables in the psql documentation and the "Environment Variables" section of the libpq documentation. You can set up your environment so all you have to type is "psql". -- Michael Fuhr http://www.fuhr.org/~mfuhr/
On Mar 21, 2005, at 4:58 PM, Walker, Jed S wrote: > Now, how do I verify from within psql what the username I'm logged in > as is? select current_user; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL
Thank you. I was doing 'select user'; -----Original Message----- From: John DeSoi [mailto:desoi@pgedit.com] Sent: Monday, March 21, 2005 5:31 PM To: Walker, Jed S Cc: 'pgsql-novice@postgresql.org' Subject: Re: [NOVICE] .pgpass file On Mar 21, 2005, at 4:58 PM, Walker, Jed S wrote: > Now, how do I verify from within psql what the username I'm logged in > as is? select current_user; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL