Skip site navigation (1) Skip section navigation (2)

Re: Creating users from shell or perl script

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Danny Aldham <danny(at)lennon(dot)postino(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating users from shell or perl script
Date: 2001-11-23 06:59:16
Message-ID: 1006498836.15065.0.camel@linda (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Fri, 2001-11-23 at 03:29, Danny Aldham wrote:
> I have written a program that will install some software,
> create a database, and create a couple of postgres users. Most
> everything is working, but I cannot see how to create postgres
> users with set passwords. If the script calls createuser the 
> prompts do not come to the user, and anyway I do not want them to.
> I want to be able to create the user with a password and not have
> the person running the script see it. Right now I am trying in perl:
> $output = `/usr/local/pgsql/bin/createuser $New_User ` ;

You don't have to do this through the shell scripts; you can use SQL

CREATE USER username WITH PASSWORD 'password'

> I have tried attaching using DBI but don't know what DB to attach to.

You can attach to any database to do this, but template1 should always
exist and should be your default choice.

Oliver Elphick                                Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight                    
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C

     "The LORD is nigh unto all them that call upon him, to
      all that call upon him in truth."        
                                   Psalms 145:18

In response to


pgsql-novice by date

Next:From: Mo HolkarDate: 2001-11-23 09:39:23
Subject: Re: Creating users from shell or perl script
Previous:From: Danny AldhamDate: 2001-11-23 03:29:39
Subject: Creating users from shell or perl script

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group