Re: How to create a new user with password in commandline with no prompt for password - Mailing list pgsql-admin

From Rajiv Rajaian
Subject Re: How to create a new user with password in commandline with no prompt for password
Date
Msg-id 238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com
Whole thread Raw
In response to How to create a new user with password in commandline with no prompt for password  ("Rajiv Rajaian" <rajiv.pgsql@gmail.com>)
Responses Clave usuario postgres  (Wolfgang Rodriguez <mayckmarck@hotmail.com>)
after initdb - Re: How to CREATEDB in commandline with no prompt for password  (bwnabble <bwiese@cotse.com>)
after initdb - Re: How to CREATEDB in commandline with no prompt for password  (bwnabble <bwiese@cotse.com>)
List pgsql-admin
Hi Vishal

Now I m able to create new user using command line
I ve created a database named 'postgres' for postgres user and I ve created
the new user  in  comand line

The steps I ve used


[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



Thanks to Vishal, Shane and pgsql-admin list

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

pgsql-admin by date:

Previous
From: "Rajiv Rajaian"
Date:
Subject: Re: How to create a new user with password in commandline with no prompt for password
Next
From: Tom Lane
Date:
Subject: Re: Power outage borked things (8.1.10)...