From: | Magnus Hagander <magnus(at)hagander(dot)net> |
---|---|
To: | Daniel Futerman <daniel(dot)futerman(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Running initdb while logged in as Administrator user (Windows) |
Date: | 2008-09-18 19:35:29 |
Message-ID: | 48D2AD81.8060308@hagander.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Daniel Futerman wrote:
> I'm trying to develop an automated PostgreSQL installer for Windows that
> uses a silent install of PostgreSQL and batch scripts to initialise the
> database cluster (i.e. run initdb) and start/stop the db server. The
> install shouldn't install as a service, so initdb needs to be run manually.
>
> The problem I'm having is that initdb cannot be run as an Administrator
> user, so I wrote a script that creates a new limited Windows user and I
> now want to run initdb using this user, but while still logged in as the
> Administrator user.
Actually, in 8.3 (at least, I can't remember if it was in 8.2 as well),
you *can* run it as admin in a lot of cases. It will drop privileges
though, so it can't use the admin permissions.
That said, using a separate account is still best practice.
> I've looked at using the RUNAS comand, but the user password has to be
> inserted manually when using this. I've also tried to pipe in the
> password using echo *** | RUNAS... where *** is the password, but this
> doesn't seem to work.
>
> I know there are some apps out there that function as alternatives to
> RUNAS but some of them require licences, and I'm looking for a
> distributable solution.
Look at psexec from Microsoft (former sysinternals).
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
You'll have to verify what the license says, but given that it's free
and comes from the guys that make Windows, it seems reasonable that it
should be doable.
> How does the PostgreSQL installer work around this when a new limited
> user can be specified when installing as a service?
The installer uses direct Win32 API functions to launch the process as a
different user.
//Magnus
From | Date | Subject | |
---|---|---|---|
Next Message | Daniel Futerman | 2008-09-18 19:39:06 | Re: Running initdb while logged in as Administrator user (Windows) |
Previous Message | Tom Lane | 2008-09-18 19:04:43 | Re: Returning NEW in an on-delete trigger |