postgres user account on OSX

Started by Darren Weberover 17 years ago7 messagesgeneral
Jump to latest
#1Darren Weber
darren.weber.lists@gmail.com

There is a postgres user account on my OSX system. I'm not clear
about how it was created. I've installed a binary version of 8.3 in
/Library/PostgreSQL/8.3/ and built another version from source into
/usr/local/pgsql/. When I login as root and then 'su - postgres' it
takes me to the postgres account and the user directory is at
/opt/local/var/db/postgresql83/.

Can someone explain how this user account was created?

I'm trying to start the server that I built from source but it will
not create a logfile, ie:

elegans:~ postgres$ /usr/local/pgsql/bin/pg_ctl -D
/usr/local/pgsql/data -l logfile start
server starting
sh: logfile: Permission denied
elegans:~ postgres$
elegans:~ postgres$ nohup /usr/local/pgsql/bin/postgres -D
/usr/local/pgsql/data </dev/null >>server.log 2>&1 </dev/null &
[1]: 28696 elegans:~ postgres$ -sh: server.log: Permission denied elegans:~ postgres$ elegans:~ postgres$ pwd /opt/local/var/db/postgresql83 elegans:~ postgres$ elegans:~ postgres$ ls -al .. total 0 drwxr-xr-x 4 root admin 136 Aug 28 12:05 . drwxr-xr-x 8 root admin 272 Sep 9 14:49 .. drwxr-xr-x 3 root admin 102 Aug 28 12:05 postgresql83 drwxr-xr-x 3 root admin 102 Aug 26 13:06 smb
elegans:~ postgres$ -sh: server.log: Permission denied
elegans:~ postgres$
elegans:~ postgres$ pwd
/opt/local/var/db/postgresql83
elegans:~ postgres$
elegans:~ postgres$ ls -al ..
total 0
drwxr-xr-x 4 root admin 136 Aug 28 12:05 .
drwxr-xr-x 8 root admin 272 Sep 9 14:49 ..
drwxr-xr-x 3 root admin 102 Aug 28 12:05 postgresql83
drwxr-xr-x 3 root admin 102 Aug 26 13:06 smb

Should I remove this user somehow and replace it with a standard user
(using the system admin GUI)?

Thanks, Darren

#2Kevin Kempter
kevin@kevinkempterllc.com
In reply to: Darren Weber (#1)
Re: postgres user account on OSX

On Linux if you install postgres via RPM's and the postgres user
account does not exist then the RPM install creates it for you and
sets the home dir to the root for the postgres binaries (i.e. /var/lib/
pgsql)

Maybe the same thing happens on a Mac install ?

On Sep 10, 2008, at 5:14 PM, Darren Weber wrote:

Show quoted text

There is a postgres user account on my OSX system. I'm not clear
about how it was created. I've installed a binary version of 8.3 in
/Library/PostgreSQL/8.3/ and built another version from source into
/usr/local/pgsql/. When I login as root and then 'su - postgres' it
takes me to the postgres account and the user directory is at
/opt/local/var/db/postgresql83/.

Can someone explain how this user account was created?

I'm trying to start the server that I built from source but it will
not create a logfile, ie:

elegans:~ postgres$ /usr/local/pgsql/bin/pg_ctl -D
/usr/local/pgsql/data -l logfile start
server starting
sh: logfile: Permission denied
elegans:~ postgres$
elegans:~ postgres$ nohup /usr/local/pgsql/bin/postgres -D
/usr/local/pgsql/data </dev/null >>server.log 2>&1 </dev/null &
[1] 28696
elegans:~ postgres$ -sh: server.log: Permission denied
elegans:~ postgres$
elegans:~ postgres$ pwd
/opt/local/var/db/postgresql83
elegans:~ postgres$
elegans:~ postgres$ ls -al ..
total 0
drwxr-xr-x 4 root admin 136 Aug 28 12:05 .
drwxr-xr-x 8 root admin 272 Sep 9 14:49 ..
drwxr-xr-x 3 root admin 102 Aug 28 12:05 postgresql83
drwxr-xr-x 3 root admin 102 Aug 26 13:06 smb

Should I remove this user somehow and replace it with a standard user
(using the system admin GUI)?

Thanks, Darren

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

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Darren Weber (#1)
Re: postgres user account on OSX

"Darren Weber" <darren.weber.lists@gmail.com> writes:

There is a postgres user account on my OSX system. I'm not clear
about how it was created. I've installed a binary version of 8.3 in
/Library/PostgreSQL/8.3/ and built another version from source into
/usr/local/pgsql/. When I login as root and then 'su - postgres' it
takes me to the postgres account and the user directory is at
/opt/local/var/db/postgresql83/.

Can someone explain how this user account was created?

I'm guessing that binary package created it for you --- check its docs,
or look at the install script if you can.

Apple includes a version of postgres in Remote Desktop, but last
I heard it was a lot older than 8.3 (7.3.x in fact :-(), and in any case
that's not where they put the database. So I don't think that's what's
causing this.

I'm trying to start the server that I built from source but it will
not create a logfile, ie:

Well, that's cause you're trying to create the logfile in a root-owned
directory that you don't have write permission on. Put the logfile
someplace you do have privileges for. Or change the ownership of the
directory --- it definitely seems pretty weird/broken to give an account
a home directory it doesn't own.

Should I remove this user somehow and replace it with a standard user
(using the system admin GUI)?

You could do that too if you liked. Postgres isn't picky about
what account it runs under, so long as it isn't root. You just need to
be sure the ownership of the database files/directories matches.

regards, tom lane

#4Shane Ambler
pgsql@Sheeky.Biz
In reply to: Tom Lane (#3)
Re: postgres user account on OSX

Tom Lane wrote:

"Darren Weber" <darren.weber.lists@gmail.com> writes:

There is a postgres user account on my OSX system. I'm not clear
about how it was created. I've installed a binary version of 8.3 in
/Library/PostgreSQL/8.3/ and built another version from source into
/usr/local/pgsql/. When I login as root and then 'su - postgres' it
takes me to the postgres account and the user directory is at
/opt/local/var/db/postgresql83/.

Can someone explain how this user account was created?

I'm guessing that binary package created it for you --- check its docs,
or look at the install script if you can.

Quite sure that the EDB binary installer sets /Library/PostgreSQL8 as
the home path, matching the install location.

The /opt/local/..... home path would indicate that you used macports or
similar at some stage and the install from there would have created it.

As the postgres user existed the EDB installer would have left it as is.

If you want a GUI to alter the home location of the existing user
account run NetInfo Manager which is in /Applications/Utilities

--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

#5Dave Page
dpage@pgadmin.org
In reply to: Shane Ambler (#4)
Re: postgres user account on OSX

On Thu, Sep 11, 2008 at 3:53 AM, Shane Ambler <pgsql@sheeky.biz> wrote:

Tom Lane wrote:

"Darren Weber" <darren.weber.lists@gmail.com> writes:

There is a postgres user account on my OSX system. I'm not clear
about how it was created. I've installed a binary version of 8.3 in
/Library/PostgreSQL/8.3/ and built another version from source into
/usr/local/pgsql/. When I login as root and then 'su - postgres' it
takes me to the postgres account and the user directory is at
/opt/local/var/db/postgresql83/.

Can someone explain how this user account was created?

I'm guessing that binary package created it for you --- check its docs,
or look at the install script if you can.

Quite sure that the EDB binary installer sets /Library/PostgreSQL8 as the
home path, matching the install location.

/Library/PostgreSQL/8.3 by default, but yes, that is essentially correct.

The /opt/local/..... home path would indicate that you used macports or
similar at some stage and the install from there would have created it.

As the postgres user existed the EDB installer would have left it as is.

Correct.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com

#6Darren Weber
darren.weber.lists@gmail.com
In reply to: Darren Weber (#1)
Re: postgres user account on OSX

Hi Shane,

I'm trying to untangle some postgresql issues on OSX. I'm now using a
macport installation for postgresql 8.3.4 and I'm using my own custom
Portfile to configure the installation (hardly changed from the main
Portfile, really). Anyhow, the macport install creates a lauchdeamon config
that uses this startup call below. When I test it directly, it's failing:

sudo su postgres -c "/opt/local/lib/postgresql83/bin/pg_ctl -D
${POSTGRESQL83DATA:=/opt/local/var/db/postgresql83/defaultdb} start -w -l
/opt/local/var/log/postgresql83/postgres.log -o \"-i -l\""

waiting for server to start...2008-10-13 19:50:21.734 pg_ctl[43992:617]
CFPreferences: user home directory at /Library/PostgreSQL/8.3 is
unavailable. User domains will be volatile.
............................................................could not start
server

Have you seen anything like this before? I have no idea what this means:
"CFPreferences: user home directory at /Library/PostgreSQL/8.3 is
unavailable"
It looks like a hangover from using a binary installer and I have no idea
how to get rid of that "CFPreference".

Any tips much appreciated ;-)

Thanks, Darren

On Fri, Sep 12, 2008 at 8:52 AM, Shane Ambler <pgsql@sheeky.biz> wrote:

Show quoted text

Darren Weber wrote:

If you want a GUI to alter the home location of the existing user

account run NetInfo Manager which is in /Applications/Utilities

I have OSX Server. This user account doesn't appear in the usual System
Preferences > Accounts. I did find it eventually under Applications >
Server > Workgroup Manager, when I selected a "local" domain to administer.

That would be a 10.5 machine.

Seems Apple has dropped netinfo manager in 10.5 and replacing it with
Directory and Directory Utility. (Data storage has changed too)

Workgroup Manager is a OSX Server app that isn't a standard part of the
client installs (but can be added by installing the server admin tools)
and (pretty sure) it will only connect to an OSX Server to administer it
- not useful for adjusting a client machine.
You could call it a more user friendly form of netinfo manager (edits
the same data)

System Preferences > Accounts will only list accounts normally created
within the Accounts Tab (I believe the criteria is userid's > 500) which
makes it easy for the novice user as they don't get to see all the
system accounts like mailman, nobody, postmaster and so on, just the
ones they have manually created.

--

Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

#7Dave Page
dpage@pgadmin.org
In reply to: Darren Weber (#6)
Re: postgres user account on OSX

On Tue, Oct 14, 2008 at 3:55 AM, Darren Weber
<darren.weber.lists@gmail.com> wrote:

Have you seen anything like this before? I have no idea what this means:
"CFPreferences: user home directory at /Library/PostgreSQL/8.3 is
unavailable"
It looks like a hangover from using a binary installer and I have no idea
how to get rid of that "CFPreference".

% sudo dscl . delete /users/postgres

will delete the user account that the binary installer created. I
assume the MacPort will recreate it as it likes.

--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com