#7 No Password Capability - Workaround

open
nobody
None
5
2004-11-05
2004-11-05
Mike McKee
No

This is actually a feature request, but I file it under
bugs because I assume that frustrated users might go
here first.

Actually, the problem stems from the psql command,
which pgst abstracts the user from using. The psql
command has no way to be passed a password from pgst.
This is a security feature. If your pg_hba.conf file is
setup so that passwords are used rather than host
trusts, then you'll notice that if you use psql to try
to attach to your database, you'll receive a password
prompt.

If you want pgst to be able to utilize a password, the
makers of the psql command have created a proper way
that they want this to be passed. You have to create a
file in $HOME called .pgaccess and chmod it with 0600
rights. Then, edit it in this format:

host:port:database:user:password

...where each line is a database/user combination that
you need.

With this change, now you can use pgst to access that
password-protected database.

A future version of pgst *MAY* (still being evaluated,
mind you) perhaps prompt for a password. Then, it will
check the .pgaccess file for an existing line for that
database/user combo. If none is found and a password
was keyed into a password field in the Connect Server
dialog, it will append this entry before attempting to
run any psql commands, thereby fixing the situation
seamlessly.

Discussion

  • Mike McKee
    Mike McKee
    2004-11-05

    Logged In: YES
    user_id=561351

    Error in that last statement. It's .pgpass, not .pgaccess.