Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid." - Mailing list pgsql-bugs

From John R Pierce
Subject Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Date
Msg-id 569F4888.9070500@hogranch.com
Whole thread Raw
In response to Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."  (Craig Ringer <craig@2ndquadrant.com>)
List pgsql-bugs
On 1/20/2016 12:30 AM, Craig Ringer wrote:
> On 20 January 2016 at 16:22, Huong Dangminh
> <huo-dangminh@ys.jp.nec.com <mailto:huo-dangminh@ys.jp.nec.com>> wrote:
>
>
>     initdb was executed with "Administrator" privileges, but
>     then initdb do popen() with none "Administrator" privileges
>     (by child process).
>
>
> That makes sense. It intentionally drops privileges.
>
> You probably have to set the ACLs up so that it can still see and
> write to the directory even after it has dropped privileges. That will
> include setting ACLs on the parent directories so that it can see
> inside them. Explicitly granting rights to the admin user you're
> running as is probably sufficient but I'm not sure.
>
> The best thing to do is probably to run initdb with non-administrator
> rights and grant permissions directly.
>
> This is the same kind of problem you get on linux systems if you 'cd'
> to some root-only directory then 'sudo -u somenormaluser ls'. You get
> an error saying the current directory isn't readable or similar.


in the newer versions of Windows (Server 2012 is roughly equivalent to
Windows 8), the \Windows\ directory is heavily protected from user
processes doing much of anything.   This is almost akin to what selinux
does to the linux system directories, but much less configurable.

there's no WAY I would want to put a postgres database in there.   I
generally create a \PostgreSQL\ directory in the root of whatever drive
I'm going to put my data in, then a X.Y (9.4 or whatever) directory
under that, and a data directory under that...  so
C:\PostgreSQL\9.4\data would be my default choice of data directories
for 9.4 on a C: only system, if the system has a separate data volume,
of course I'd use that instead.


--
john r pierce, recycling bits in santa cruz

pgsql-bugs by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Next
From: carloshljr@yahoo.com.br
Date:
Subject: BUG #13877: Fails to install