Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password

From: Shane Ambler <pgsql(at)Sheeky(dot)Biz>
To: bwnabble <bwiese(at)cotse(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: after initdb - Re: How to CREATEDB in commandline with no prompt for password
Date: 2008-03-05 03:43:19
Message-ID: 47CE16D7.4050700@Sheeky.Biz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-es-ayuda

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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message madhu.harchandani 2008-03-05 04:31:46 ident authentication problem
Previous Message Christopher Ly 2008-03-05 01:11:58 Can't Download Postgresql-V8.2.4 for Redhat Enteprise-V4

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2008-03-05 04:53:52 Re: Postgresql 8.4 caracteristicas
Previous Message Raúl Andrés Duque 2008-03-05 02:01:27 Re: Postgresql 8.4 caracteristicas