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

From Craig Ringer
Subject Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Date
Msg-id CAMsr+YF7yzFhRjHt28-XWKaOO6h87_H8qvroFsdFkwDVHeoqQQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."  (Huong Dangminh <huo-dangminh@ys.jp.nec.com>)
Responses Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
List pgsql-bugs
On 20 January 2016 at 16:22, Huong Dangminh <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.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-bugs by date:

Previous
From: Huong Dangminh
Date:
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Next
From: John R Pierce
Date:
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."