Search Postgresql Archives

Re: Running initdb while logged in as Administrator user (Windows)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux