Re: [HACKERS] Re: initdb.sh fixed

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: initdb.sh fixed
Date: 1999-12-20 03:45:04
Message-ID: 199912200345.WAA23177@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Seems either $USER or $LOGNAME should be set in all cases.
>
> One or both is probably set in most shell environments ... but
> it's not necessarily *right*. If you've su'd to postgres from
> your login account, these env vars may still reflect your login.
>
> > I am now using:
> > POSTGRES_SUPERUSERID="`id -u 2>/dev/null || echo 0`"
> > Let's see how portable that is?
>
> Some quick experimentation shows that id -u isn't too trustworthy,
> which is a shame because it's the POSIX standard. But I find that
> the SunOS implementation ignores -u:
>
> $ id -u
> uid=6902(tgl) gid=50(users0) groups=50(users0)
>
> And no doubt there will be platforms that haven't got "id" at all.
>
> It might be best to provide a little bitty C program that calls
> geteuid() and prints the result...

We could argue that Postgres is the super-user for the database, it
should be zero userid.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-12-20 04:19:17 Re: [HACKERS] Re: initdb.sh fixed
Previous Message Tom Lane 1999-12-20 03:26:11 Re: [HACKERS] Re: initdb.sh fixed