How to create a new user with password in commandline with no prompt for password

From: "Rajiv Rajaian" <rajiv(dot)pgsql(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: How to create a new user with password in commandline with no prompt for password
Date: 2008-02-20 07:30:40
Message-ID: 238696420802192330g69e3c447jeadd1d3d31506eda@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-es-ayuda

Hi all
Im using postgresql-8.0.3-1.
I need to create a new user in postgresql with password ..But it should not
prompt me to get the password ..ie only through command line I've to give
the password as input
Steps i had done are as follows

[root(at)g151 ~]# su postgres -c "createuser -A -d globus"
could not change directory to "/root"
CREATE USER

[root(at)g151 ~]# su globus -c "createdb rftDatabase"
could not change directory to "/root"
CREATE DATABASE

Also in /var/lib./pgsql/data/pg_hba.conf I ve added the entry as

host rftDatabase "globus" "172.16.10.151" 255.255.255.0 md5

Now when i tried to login to that database I got the following error

[root(at)g151 ~]# psql -U globus -d rftdatabase
psql: FATAL: Ident authentication failed for user "globus"

Also with password promt it was prompting password ..But I haven't created
the user with password
[root(at)g151 ~]# psql -U globus -d rftdatabase -W
Password:

Is it possible to create any new user in postgresql with password through
command line and with no prompt for password.??Is there any option in
Postgresql?
Also if I create a new user with su postgres -c "createuser -A -d
globus" .Will it set any default password while creating the user ??

Please I need some valuable suggestion s

Thanks /Regards
Rajiv
Project Associate
CARE,MIT,
Anna University

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Shane Ambler 2008-02-20 08:06:16 Re: How to create a new user with password in commandline with no prompt for password
Previous Message forest mars 2008-02-19 23:25:08 Re: Actions: Edit / Delete only appears for some tables ?

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Shane Ambler 2008-02-20 08:06:16 Re: How to create a new user with password in commandline with no prompt for password
Previous Message Douglas Escobar 2008-02-20 00:47:25 RE: [pgsql-es-ayuda] Error de Conexión