Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 959852E0161 for ; Tue, 4 Mar 2008 23:43:29 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 05312-03 for ; Tue, 4 Mar 2008 23:43:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ipmail01.adl6.internode.on.net (ipmail01.adl6.internode.on.net [203.16.214.146]) by postgresql.org (Postfix) with ESMTP id 32A382E015F for ; Tue, 4 Mar 2008 23:43:25 -0400 (AST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FALOjzUfLevdH/2dsb2JhbAAsgSqQZplM X-IronPort-AV: E=Sophos;i="4.25,444,1199626200"; d="scan'208";a="55194354" Received: from ppp247-71.static.internode.on.net (HELO DevBox.local) ([203.122.247.71]) by ipmail01.adl6.internode.on.net with ESMTP; 05 Mar 2008 14:13:21 +1030 Message-ID: <47CE16D7.4050700@Sheeky.Biz> Date: Wed, 05 Mar 2008 14:13:19 +1030 From: Shane Ambler User-Agent: Thunderbird 2.0.0.6 (Macintosh/20070728) MIME-Version: 1.0 To: bwnabble CC: pgsql-admin@postgresql.org Subject: Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password References: <238696420802192330g69e3c447jeadd1d3d31506eda@mail.gmail.com> <47BBDF78.7070801@Sheeky.Biz> <238696420802200115m522cfd11h2f37d87845c2d6e0@mail.gmail.com> <238696420802200219y7bfd4269u498dd1fe0b80c2cc@mail.gmail.com> <238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com> <15817886.post@talk.nabble.com> In-Reply-To: <15817886.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200803/31 X-Sequence-Number: 28514 bwnabble wrote: > > Did you have your METHODs set to "trust" in your "pg_hba.conf" file (in the > $PGDATA directory)? > > My question is, similar to yours, is there a way to: > 1) run "initdb" as user "postgres" on an empty $PGDATA directory to start > from scratch > 2) change the METHODs in "$PGDATA/pg_hba.conf" from "trust" -> "password" > 3) start the postgresql server > 4) run "createdb mydb" with no prompt for a password? (as user root or > postgres?) 1 & 3 are standard CLI commands that can be scripted as well as anything else you do on your system. (3 would be scripted already so that pg starts with the system) 2 is a simple editing of a file that gets performed once after step 1. You would only do steps 1-3 once on a system (maybe a few more if you are repeating it as a learning experience) cratedb on the other hand may be something that gets run every time a new user gets added to your server. If you are looking to automate step 4 then you bypass the password prompt with a trust entry that is only for the machine or user that will perform the operation. The other option is using a .pgpass file. If you are at a point where you want to automate setting up a large number of new systems and you don't know enough about *nix systems to create these scripts yourself then you should take a few steps back and learn more about *nix sysadmin before you move on. -- Shane Ambler pgSQL (at) Sheeky (dot) Biz Get Sheeky @ http://Sheeky.Biz