473,772 Members | 3,665 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

psql password prompt

Hi All.

There is one thing which somewhat annoys me, which is that psql always
prompts me for a password.
That makes it difficult for use in Makefile where I want to say 'make
build_db', which would run psql for
each stored procedure which needs to be updated. Is there a way to
specify that password somehow in a
command line like isql ( sybase cli client ) does?

--
Dmitri Priimak
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #1
2 8730
In epistula a Dmitri Priimak, die horaque Sat, Sep 25, 2004 at 09:48:54AM -0700:
Hi All.

There is one thing which somewhat annoys me, which is that psql always
prompts me for a password.
That makes it difficult for use in Makefile where I want to say 'make
build_db', which would run psql for
each stored procedure which needs to be updated.
In that case, I would dump all operations into an SQL script
and run psql once from that script, if possible.

Other options (ranging from totally insecure to more secure
than password authentication and from easy to complex in
implementation) are available, if you have administrative
control over the PostgreSQL-server:

- completely disable authentication (in $PG_DATA/pg_hba.conf)
- disable authentication for your machine only
- run the update commands on the same machine as PostgreSQL runs
and set the Unix domain socket to "ident sameuser" authentication
- use kerberos authentication

Otherwise I do not know of any other possibility to resolve
your problem other than hacking psql and implementing the
desired parameter.
Is there a way to
specify that password somehow in a
command line like isql ( sybase cli client ) does?


That would be truly poor idea. The command line of any process is
normally visible to every user on the system via the `ps' command:

== password.sh ==
#! /bin/sh
sleep 10
== password.sh ==

% sh password.sh & sleep 1; ps | grep password
3233 p2 SN+ 0:00,01 sh password.sh --password myPassword

Cheers,
Peter

--
Wir leben in einer Welt, worin ein Narr viele Narren, aber ein weiser
Mann nur wenige Weise macht.
-- Immanuel Kant

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #2

On Sep 25, 2004, at 12:48 PM, Dmitri Priimak wrote:
There is one thing which somewhat annoys me, which is that psql always
prompts me for a password.
That makes it difficult for use in Makefile where I want to say 'make
build_db', which would run psql for
each stored procedure which needs to be updated. Is there a way to
specify that password somehow in a
command line like isql ( sybase cli client ) does?


You should be able to leave out the password altogether if you setup a
..pgpass file in your home directory.

http://www.postgresql.org/docs/curre...pq-pgpass.html
Best,

John DeSoi, Ph.D.
---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddres sHere" to ma*******@postg resql.org)

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
37781
by: Willem Herremans | last post by:
I am developing a client application for postgreSQL in Tcl/Tk (see http://gborg.postgresql.org/project/pfm ). It mainly uses PgTcl or pgintcl. I don't have any problems with those, but I am also trying to call psql from my application for SQL statements typed directly by the user. I have used the Tcl command set psqlChannel
4
2154
by: Brendan Jurd | last post by:
Hello all, I just wanted to pass on some information about compatibility between the psql client and the postgres server. On a particular network, my workstation and the server are both debian boxes, but the workstation is on a more frequent upgrade schedule. The server is still running postgres 7.3.4, but my workstation has been upgraded with the latest (7.4.1) postgres client tools.
0
452
by: David Roche | last post by:
Hello, I searched all through Google Groups, Google, and the Postgres docs, but to no avail. I hope someone can help me out here! I have a file that contains SQL, and some Postgres-specific slash commands. This file calls an external shell script via the backtick mechanism, and saves the value into a psql variable, for latter insertion into a table. It looks something like this:
1
1664
by: Leo Leo | last post by:
Hi! How can I interpret a variable in psql, when the variable has to be quoted? for example: \set myVar myValue \echo :myVar The Result ist then "myValue" ==> ok
6
6369
by: John DeSoi | last post by:
Is there a way to provide a md5 password directly to psql? I'm aware of pgpass but I would like to store a md5 password in some other location and then use it to execute commands with psql. Thanks, John DeSoi, Ph.D. ---------------------------(end of broadcast)---------------------------
15
2518
by: Dino Vliet | last post by:
Hi folks, probably this is a question you've heard so many times but I wasn't able to find a solution to it. I'm using a shell script to create a textfile for me. It looks like #!/usr/local/bin/bash psql -c "select foo from bar;" -d database1 -t psql -c "\q" -d database1 exit 0
1
2195
by: Josué Maldonado | last post by:
Hello List, I'm having this issue with beta 8.0 C:\pgsql\bin>pg_dump -U postgres farmacia > xfar.sql Password: C:\pgsql\bin>psql -U postgres farmacia2 < xfar.sql Password: psql: FATAL: Password authentication failed for user "postgres" C:\pgsql\bin>psql -U postgres -W farmacia2 < xfar.sql
2
1761
by: Russ Brown | last post by:
Hello, Today I tried connecting to my database locally via psql. I got the usual welcome & basic help messages, but it never got to the prompt: it just hung. So I checked top and the psql process was increasing in size at quite a rate (up to a gig in under 30 seconds). I'd been using psql with no problems only a couple of hours ago, and I haven't installed anything for at least a couple of days that I can think of.
5
5915
by: damacy | last post by:
hello, everyone. i am trying to write a program which executes SQL commands stored in ..sql files. i wrote a function called psql() whose contents look like the following. .... os.popen(command)
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.