Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aM8NV-0003cu-Im for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Jan 2016 06:05:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aM8NV-0005DI-5Y for pgsql-bugs@arkaria.postgresql.org; Thu, 21 Jan 2016 06:05:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aM8Mr-0004Uw-UG for pgsql-bugs@postgresql.org; Thu, 21 Jan 2016 06:05:13 +0000 Received: from rc3.surewest.net ([66.60.130.52]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1aM8Mm-00085m-Ei for pgsql-bugs@postgresql.org; Thu, 21 Jan 2016 06:05:12 +0000 Received: from smtp3.surewest.net ([66.60.130.145]) by rc3.surewest.net ({89e988b2-2a53-469e-91f0-3e9924092bec}) via TCP (outbound) with ESMTP id 20160121060502387_0000; Wed, 20 Jan 2016 22:05:02 -0800 X-RC-FROM: Received: from vinny.peecee3.com (158.183-62-69.ftth.swbr.surewest.net [69.62.183.158]) by smtp3.surewest.net (Postfix) with ESMTP id 095CD896B9; Wed, 20 Jan 2016 22:03:59 -0800 (PST) Received: from vinny.peecee3.com (localhost.localdomain [127.0.0.1]) by vinny.peecee3.com (8.15.2/8.14.9) with ESMTP id u0L651vA029843; Wed, 20 Jan 2016 22:05:01 -0800 Received: (from chas@localhost) by vinny.peecee3.com (8.15.2/8.15.2/Submit) id u0JMSmmo002428; Tue, 19 Jan 2016 14:28:48 -0800 Date: Tue, 19 Jan 2016 14:28:48 -0800 From: cpolish@surewest.net To: Dang Minh Huong Cc: "'Thomas Kellerer'" , pgsql-bugs@postgresql.org Subject: Re: Window2012R2: initdb error: "The current directory is invalid." Message-ID: <20160119222848.GB18963@vinny.peecee3.com> References: <75DB81BEEA95B445AE6D576A0A5C9E9364CAD50F@BPXM05GP.gisp.nec.co.jp> <041201d152bf$a508bee0$ef1a3ca0$@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <041201d152bf$a508bee0$ef1a3ca0$@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-MAG-OUTBOUND: surewest.redcondor.net@66.60.130.145/32 X-Pg-Spam-Score: -1.3 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2016-01-19 22:45, Dang Minh Huong wrote: > > owner@postgresql.org] On Behalf Of Thomas Kellerer > > Huong Dangminh schrieb am 19.01.2016 um 11:49: > > > I have failed in execute initdb in "c:\Windows\Temp\dir" folder as > > > reproduce logs below. The OS's messages "The current directory is invalid." > > > was returned. > > > > c:\Windows has special protection and it is not really surprising that a regular > > user isn't allowed to write into that directory. > > > > When Postgres is started it drops all "Administrator" privileges for security > > reasons (older versions would refuse to start as > > Administrator) - and I think initdb is doing the same thing. > > So it's understandable that it can't write to c:\Windows > > > > I did not mean, create data cluster in C drive made that error sir. > This issue reproduce in all drive specified in -D option. > # My reproduce environment is only one (C) drive. So, sorry for the log. > > I mean, it happen when current directory of command line is "c:\Windows\Temp\something". > It is rare case, and may be a Windows2012's specification, but i don't know > why only "c:\Windows\Temp\something" and are there another case like that? > > > Putting application data into c:\Windows (or "c:\Program Files" for that > > matter) is an extremely bad idea to begin with (c:\Windows being even > > worse than "c:\Program Files") > > > > You shouldn't be doing that anyway. As Thomas said, it is undesireable to log into a server as administrator. You should create and use a privileged user, for example dmhadmin, insert that user into the administrators group. Also create an ordinary user, perhaps dmh, and log in with that account. Download the postgres installer, run it as the ordinary user. You will be prompted for a privileged user account, enter the priviledged account (for example, dmhadmin). When asked for the location to install the database, create a new folder named postgres on a non-system (not C:) disk. If your server can only have one disk you might install the database in C:\postgres, which you'll have the opportunity to create from inside the installer's "browse..." dialog. This folder will be owned by the local server's "administrators" group with appropriate privileges. C:\Windows\Temp is not an appropriate choice for storing persistent program data. If you ignore this by manipulating the permissions you will eventually be harmed when a privileged program clears the entire contents. Hope that helps, -- Charles -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs