Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id C79952E0044 for ; Wed, 20 Feb 2008 07:11:27 -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 75266-01 for ; Wed, 20 Feb 2008 07:11:16 -0400 (AST) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id BE76A2E004F for ; Wed, 20 Feb 2008 07:11:21 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d37so4403957pye.29 for ; Wed, 20 Feb 2008 03:11:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=r1h+sWQmNDn79r5E3zl9iAI/C4qCvHzJZhaiORZ+D2o=; b=GWMySBQO6FVSIBKN1IHGH58o8EVSzN5gw5kgitpODo8T/F+H2WpboS5ABH8sBAfrAASvzftxrFuhEV9x0Tja5M+mHVGYo6XMdDPpkSzRg5owQH0+rppPstge24PqtaQHPWWDeRk5JAWFvYiawJsS2XuqHSH9pgOqTA/8J0j4tYc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=XZ8y6oU3xptvyTFOA3dvZDhiRA6x6FfZEyG/PeEwDCSpFh9YJSOckSwDPL1s5mdEGbLFN1MpXf2WUDVznNv66IxYul8nZYL8qy4gDDpHdAaibCx19KL5v8UUiwXtHVUP3O7YQZfhQN5JdrbpDEdzKzJ4DYtPwnP/nQZHp/6s+oo= Received: by 10.141.142.15 with SMTP id u15mr1773590rvn.66.1203505880078; Wed, 20 Feb 2008 03:11:20 -0800 (PST) Received: by 10.141.152.4 with HTTP; Wed, 20 Feb 2008 03:11:20 -0800 (PST) Message-ID: <238696420802200311y40a93a38jbd601e280d2fb860@mail.gmail.com> Date: Wed, 20 Feb 2008 16:41:20 +0530 From: "Rajiv Rajaian" To: "Vishal Arora" Subject: Re: How to create a new user with password in commandline with no prompt for password In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6152_30139249.1203505880077" References: <238696420802192330g69e3c447jeadd1d3d31506eda@mail.gmail.com> <47BBDF78.7070801@Sheeky.Biz> <238696420802200115m522cfd11h2f37d87845c2d6e0@mail.gmail.com> <238696420802200219y7bfd4269u498dd1fe0b80c2cc@mail.gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL=0.000, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200802/230 X-Sequence-Number: 28304 ------=_Part_6152_30139249.1203505880077 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_6152_30139249.1203505880077 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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
------=_Part_6152_30139249.1203505880077--