pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-bugs@postgresql.org
Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
Date: Wed, 20 Jan 2016 00:42:48 -0800
Message-ID: <569F4888.9070500@hogranch.com> (raw)
In-Reply-To: <CAMsr+YF7yzFhRjHt28-XWKaOO6h87_H8qvroFsdFkwDVHeoqQQ@mail.gmail.com>
References: <75DB81BEEA95B445AE6D576A0A5C9E9364CAD50F@BPXM05GP.gisp.nec.co.jp>
	<CAMsr+YHib0t-T7XkDWTGwCN8aJG0MqpqHOn3Cyfpfg0av__V5w@mail.gmail.com>
	<75DB81BEEA95B445AE6D576A0A5C9E9364CAE0B8@BPXM05GP.gisp.nec.co.jp>
	<CAMsr+YF7yzFhRjHt28-XWKaOO6h87_H8qvroFsdFkwDVHeoqQQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

view thread (9+ messages)  latest in thread

Message-ID: <569F4888.9070500@hogranch.com>
Permalink:  ../569F4888.9070500@hogranch.com/
Also on:    postgresql.org/message-id/569F4888.9070500@hogranch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pierce@hogranch.com
  Subject: Re: [HACKERS] Window2012R2: initdb error: "The current directory is invalid."
  In-Reply-To: <569F4888.9070500@hogranch.com>
  References: <75DB81BEEA95B445AE6D576A0A5C9E9364CAD50F@BPXM05GP.gisp.nec.co.jp> <CAMsr+YHib0t-T7XkDWTGwCN8aJG0MqpqHOn3Cyfpfg0av__V5w@mail.gmail.com> <75DB81BEEA95B445AE6D576A0A5C9E9364CAE0B8@BPXM05GP.gisp.nec.co.jp> <CAMsr+YF7yzFhRjHt28-XWKaOO6h87_H8qvroFsdFkwDVHeoqQQ@mail.gmail.com> <569F4888.9070500@hogranch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox