Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Date: 2016-01-20 08:42:48
Message-ID: 569F4888.9070500@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 1/20/2016 12:30 AM, Craig Ringer wrote:
> On 20 January 2016 at 16:22, Huong Dangminh
> <huo-dangminh(at)ys(dot)jp(dot)nec(dot)com <mailto:huo-dangminh(at)ys(dot)jp(dot)nec(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Smith, Travis 2016-01-20 16:12:00 Re: BUG #13875: Error explaining query
Previous Message Craig Ringer 2016-01-20 08:30:12 Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2016-01-20 09:17:15 Re: Why format() adds double quote?
Previous Message Shulgin, Oleksandr 2016-01-20 08:35:55 Re: Stream consistent snapshot via a logical decoding plugin as a series of INSERTs