Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id EDD2F2E0274 for ; Mon, 3 Mar 2008 20:51:06 -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 54050-08 for ; Mon, 3 Mar 2008 20:50:55 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from kuber.nabble.com (kuber.nabble.com [216.139.236.158]) by postgresql.org (Postfix) with ESMTP id 0DB782E0092 for ; Mon, 3 Mar 2008 20:51:01 -0400 (AST) Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JWLMw-0001FQ-Pa for pgsql-admin@postgresql.org; Mon, 03 Mar 2008 16:50:58 -0800 Message-ID: <15817886.post@talk.nabble.com> Date: Mon, 3 Mar 2008 16:50:58 -0800 (PST) From: bwnabble To: pgsql-admin@postgresql.org Subject: after initdb - Re: How to CREATEDB in commandline with no prompt for password In-Reply-To: <238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: bwiese@cotse.com References: <238696420802192330g69e3c447jeadd1d3d31506eda@mail.gmail.com> <47BBDF78.7070801@Sheeky.Biz> <238696420802200115m522cfd11h2f37d87845c2d6e0@mail.gmail.com> <238696420802200219y7bfd4269u498dd1fe0b80c2cc@mail.gmail.com> <238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.587 tagged_above=0 required=5 tests=DNS_FROM_OPENWHOIS=2.431, WHOIS_MYPRIVREG=0.156 X-Spam-Level: ** X-Archive-Number: 200803/24 X-Sequence-Number: 28507 Rajiv Rajaian-2 wrote: > > [root@g151 ~]# su postgres -c "createdb postgres" > could not change directory to "/root" > CREATE DATABASE > [root@g151 ~]# echo "CREATE USER globus WITH PASSWORD 'globus' CREATEDB;" > | > psql -U postgres -d postgres > psql: FATAL: Ident authentication failed for user "postgres" > [root@g151 ~]# su postgres -c "echo \"CREATE USER globus WITH PASSWORD > 'globus' CREATEDB;\" | psql -U postgres -d postgres" > could not change directory to "/root" > CREATE USER > [root@g151 ~]# su globus -c "createdb rftDatabase" > could not change directory to "/root" > CREATE DATABASE > Rajiv, 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?) I can only perform step 4 (createdb mydb) when the default METHOD is "trust" in pg_hba.conf and I'm wondering if is any way around it? I want to disable "trust" for security purposes. Must I use the METHOD "trust" first in order to create a user with "createdb" privileges, and then change METHODs in pg_hba.conf from "trust" to "password"? -- View this message in context: http://www.nabble.com/How-to-create-a-new-user-with-password-in-commandline-with-no-prompt-for-password-tp15583904p15817886.html Sent from the PostgreSQL - admin mailing list archive at Nabble.com.