RE: Specifying psql password on command line - Mailing list pgsql-general

From Tauren Mills
Subject RE: Specifying psql password on command line
Date
Msg-id NBBBLBKDJMGDNPMDGAABEEBEAEAB.tauren@servlets.net
Whole thread Raw
In response to Re: Specifying psql password on command line  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
> > I've read the documentation for the psql commands as well as
> the createdb
> > and dropdb commands.  It looks like there is no way to specify
> the password
> > on the command line.  The password is always provided in the
> form of a stdin
> > prompt.
>
> Quite deliberately ... if passwords were provided on the command line,
> then anyone else on your machine could read them off with 'ps'.

I was actually wondering if that was the reason.  I know that with MySQL,
the mysql program immediately changes the command line that is displayed
with 'ps' so that you simply see 'xxxxxx' for the password.  However, there
is an instant that ps could report the password.

I would think that there would be some way to do this, however.  For
instance, specify a file path that contains the password.  It seems like
someone out there must be running the command line programs from an
automated script.  How are you doing it?  Using something like 'expect'?

I'd love to see an example script if anyone has one.

Thanks,
Tauren





pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Specifying psql password on command line
Next
From: "Tauren Mills"
Date:
Subject: RE: [ADMIN] Alternate database locations