newbie question
Daniel J. Luke
dluke at geeklair.net
Wed May 4 06:30:26 PDT 2011
On May 3, 2011, at 9:27 PM, Tena Sakai wrote:
>
> When I try what you mention ("psql -U postgres postgres")
> here's what happens:
> $ /opt/local/lib/postgresql90/bin/psql -U postgres postgres
> Password for user postgres:
> psql: FATAL: password authentication failed for user "postgres"
that's because you supplied an incorrect password for the postgres user.
> I gave "trust" as you suggested.
nope, I suggested that the default authentication method (as set in your pg_hba.conf file) was 'trust' authentication which does not require a password.
> Clearly the account postgres exists. (Because I can su to it
> from being root.)
you are confusing a system level postgres account with a database postgres account/user
> But on this incarnation of the OS (snow
> leopard, 10.6.7), one is supposed to manage password
> changes via Accounts (in System Preferences). And
> according to Accounts, there is no such user as postgres.
> Curiously, it does show the group postgres.
the Accounts pane in system preferences doesn't show all system accounts.
> I have looked at the passwd file via vipw and postgres doesn't
> exist in it. So, where is the account postgres?
on Mac OS X, system accounts (and passwords) are not stored in the passwd file.
> Here's something else kinda strange:
> $ echo ~postgres
> /Applications/postgres
> $ ls -ld /Applications/postgres
> ls: /Applications/postgres: No such file or directory
that doesn't really matter (although it probably means your postgres user wasn't created by macports, as the postgres90-server port creates the postgres user with a $HOME of ${prefix}/var/db/postgresql90)
> At this point, I went back to Accounts (via System Preferences)
> and looked at group postgres. And I saw my account is shown
> in membership panel and there is a box for check mark next to
> it, which was unchecked. I checked it and got out of the Accounts
> and rerun psql command as before:
> $ psql -U postgres postgres
> psql (9.0.4)
> Type "help" for help.
>
> postgres=# \q
>
> Bingo! it doesn't ask password anymore!
you probably have a ~/.pgpass with the password you set for the postgres user saved in it (and the permissions on the file were probably set for the postgres group).
> Now I can go ahead to create database of my choice and populate
> tables, it seems.
You really should read through the postgres documentation as it does seem like you don't understand how postgres client authentication works.
http://www.postgresql.org/docs/9.0/interactive/client-authentication.html
--
Daniel J. Luke
+========================================================+
| *---------------- dluke at geeklair.net ----------------* |
| *-------------- http://www.geeklair.net -------------* |
+========================================================+
| Opinions expressed are mine and do not necessarily |
| reflect the opinions of my employer. |
+========================================================+
More information about the macports-users
mailing list