newbie question

Tena Sakai sakaitena at yahoo.com
Wed May 4 11:31:55 PDT 2011


Hi Daniel,

>> 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.

OK, I agree.  But then how can I manipulate password and
other attributes of those accounts that are hidden?

>> 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).

No, I don't have one.  (I was thinking of making one, though):

  $ ls ~/.pgpass
  ls: /Users/tws/.pgpass: No such file or directory

Regards,

Tena

--- On Wed, 5/4/11, Daniel J. Luke <dluke at geeklair.net> wrote:

From: Daniel J. Luke <dluke at geeklair.net>
Subject: Re: newbie question
To: "Tena Sakai" <sakaitena at yahoo.com>
Cc: "MacPorts Users" <macports-users at lists.macosforge.org>
Date: Wednesday, May 4, 2011, 6:30 AM

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.          |                          
+========================================================+



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20110504/a9fc83c5/attachment.html>


More information about the macports-users mailing list