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 [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel
for psql. By writing to that channel, SQL statements are sent to psql,
by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The
problem is that psql does not use this channel for prompting for or
reading the password. Instead, the password is prompted for on, and read
from, the terminal from which the tcl application was started and that
is not what I want, because the Tcl application has already received the
password from the user. It is, as if psql does not use stdout and stdin
for the password.
It would already be helpful if I knew how to make a shell script that
first reads the password and then provides that password to psql, such
that the user is not prompted for the password again.
I have already tried bash constructions like
PASSWORD='blabl a'
psql $dbname <<EOF
$PASSWORD
EOF
But the result is still that psql prompts for the password on the
terminal from which the script is run.
Does anybody know how to solve this problem?
Thanks in advance,
--
Willem Herremans
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings 7 37779
On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote: I have used the Tcl command set psqlChannel [open "|psql $dbname" RDWR] to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql. That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
Look in the manpage for psql, there are several ways to stop it asking for
passwords, including the PGPASS environment variable, tne .pgpass file and
setting the user as trust in the config.
Any of these will do what you want...
Hope this helps,
--
Martijn van Oosterhout <kl*****@svana. org> http://svana.org/kleptog/ If the Catholic church can survive the printing press, science fiction will certainly weather the advent of bookwarez. http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQFALorIY5T wig3Ge+YRAnm8AJ 9z8brBxVqYWOYO5 twJZJEM/YKnsgCfamJC
JpstcQXoDLhlgwV cbADsn38=
=w5AL
-----END PGP SIGNATURE-----
Martijn van Oosterhout wrote: On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote:
I have used the Tcl command
set psqlChannel [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
Look in the manpage for psql, there are several ways to stop it asking for passwords, including the PGPASS environment variable, tne .pgpass file and setting the user as trust in the config.
Any of these will do what you want...
Hope this helps,
I am afraid this does not help me very much.
The manpage of psql neither mentions the PGPASS environment variable,
nor the .pgpass file.
I understand that, if the server is configured such that the client can
authenticate wihout password, that psql does not prompt for a password,
but it would be a serious limitation for my application that it cannot
support authenitication by means of password.
Kind regards,
--
Willem Herremans
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings
On Sun, 15 Feb 2004, Willem Herremans wrote: Martijn van Oosterhout wrote:
On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote:
I have used the Tcl command
set psqlChannel [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
Look in the manpage for psql, there are several ways to stop it asking for passwords, including the PGPASS environment variable, tne .pgpass file and setting the user as trust in the config.
Any of these will do what you want...
Hope this helps,
I am afraid this does not help me very much.
The manpage of psql neither mentions the PGPASS environment variable, nor the .pgpass file.
It's actually in the libpq documentation.. .
The file .pgpass in a user's home directory is a file
that can contain passwords to be used if the connection requires a
password (and no password has been specified otherwise).
This file should have lines of the following format:
hostname:port:d atabsae:usernam e:password
Each of the first four fields may be a literal value, or * which matches
anything. The password field from the first line that matches the
current connection parameters will be used. (Therefore, put more-specific
entries first when you are using wildcards.)
If an entry needs to contain : or
\, escape this character with \.
The permissions on .pgpass must disallow any
access to world or group; achieve this by the command
chmod 0600 ~/.pgpass
If the permissions are less strict than this, the file will be ignored.
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
On Sun, Feb 15, 2004 at 10:27:07AM +0100, Willem Herremans wrote: I am afraid this does not help me very much. The manpage of psql neither mentions the PGPASS environment variable, nor the .pgpass file.
Ok, so they're mentioned in the documentation, one under environment
variables. The other is mentioned in there too, aswell as briefly on the
manpage for pg_dumpall. A quick google should find the details for you.
I understand that, if the server is configured such that the client can authenticate wihout password, that psql does not prompt for a password, but it would be a serious limitation for my application that it cannot support authenitication by means of password.
You could always redirect the password into stderr, though that's a bit of a
hack. Better just use one of the above supported methods.
--
Martijn van Oosterhout <kl*****@svana. org> http://svana.org/kleptog/ If the Catholic church can survive the printing press, science fiction will certainly weather the advent of bookwarez. http://craphound.com/ebooksneitherenorbooks.txt - Cory Doctorow
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQFAL0DrY5T wig3Ge+YRAlRbAJ 0UMDN652jeC29bC JlUTxrUf38MagCg g7ml
WOB0UcpdNNincH9 msIdn+DY=
=sqNF
-----END PGP SIGNATURE-----
Stephan Szabo wrote: On Sun, 15 Feb 2004, Willem Herremans wrote: Martijn van Oosterhout wrote: On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote:
I have used the Tcl command
set psqlChannel [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
Look in the manpage for psql, there are several ways to stop it asking for passwords, including the PGPASS environment variable, tne .pgpass file and setting the user as trust in the config.
Any of these will do what you want...
Hope this helps, I am afraid this does not help me very much.
The manpage of psql neither mentions the PGPASS environment variable, nor the .pgpass file.
It's actually in the libpq documentation.. .
The file .pgpass in a user's home directory is a file that can contain passwords to be used if the connection requires a password (and no password has been specified otherwise). This file should have lines of the following format: hostname:port: databsae:userna me:password
Each of the first four fields may be a literal value, or * which matches anything. The password field from the first line that matches the current connection parameters will be used. (Therefore, put more-specific entries first when you are using wildcards.) If an entry needs to contain : or \, escape this character with \.
The permissions on .pgpass must disallow any access to world or group; achieve this by the command chmod 0600 ~/.pgpass If the permissions are less strict than this, the file will be ignored.
---------------------------(end of broadcast)--------------------------- TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html
Marvellous!. That solves my problem!
Thank you.
Willem Herremans
--
Willem Herremans E-mail: wi************* *@belgacom.net
Dennenlaan 55
B-2520 Ranst Tel. : +32 3 485 64 09
BELGIUM
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Try this...i'm using this with pg_dump
echo -n -e "username\npass word\n" | pg_dump -u -v dbname > dbname.pgdump
thanks!
On Sat, 2004-02-14 at 15:53, Martijn van Oosterhout wrote: On Sat, Feb 14, 2004 at 05:11:14PM +0100, Willem Herremans wrote: I have used the Tcl command
set psqlChannel [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
Look in the manpage for psql, there are several ways to stop it asking for passwords, including the PGPASS environment variable, tne .pgpass file and setting the user as trust in the config.
Any of these will do what you want...
Hope this helps,
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly
Willem Herremans wrote: 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 [open "|psql $dbname" RDWR]
to create a channel that effectively becomes the input/output channel for psql. By writing to that channel, SQL statements are sent to psql, by reading from that channel, the results are received from psql.
That works fine, as long as psql does not prompt for a password. The problem is that psql does not use this channel for prompting for or reading the password. Instead, the password is prompted for on, and read from, the terminal from which the tcl application was started and that is not what I want, because the Tcl application has already received the password from the user. It is, as if psql does not use stdout and stdin for the password.
You need to look in the libpq section of the manuals. There is a
PGPASSWORD environment variable, but that is deprecated. The preferred
method is to create a ~/.pgpass file containing password information.
--
Richard Huxton
Archonet Ltd
---------------------------(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) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Adams-Blake Co. |
last post by:
I want to allow the user to enter her own username and password.
I want to validate the password the way lots of programs do.... that it has
to be:
- 6 or more characters.
- must be at least one upper and one lower case letter in the password.
- must be at least one number in the password.
|
by: Wm |
last post by:
Something just occurred to me... <yeah, I know, it scared me too> I just
password-protected a website by including a password authentication script
in each page of a private section. The script checks the login against the
mySQL database. This type of protection will only affect the .php pages,
won't it? The images that are contained in the pages are not protected, as
they would be if I had a .htaccess file on the parent directory..? This...
|
by: dave |
last post by:
Hello,
I'm trying to get this password generator to work. I keep getting
brought back to the original page, never to the page which says what my
password will be in encrypted format. I'm running php4 and apache2 on a
FreeBSD system if it matters.
Any help appreciated.
Thanks.
Dave.
<html>
|
by: juglesh |
last post by:
<body><div align="center">
<?php
if (!isset($password)){
?><form action="<?php $_SERVER; ?>" method="post">
type password here <input name="password" type="text" size="8"> then
<input name="submit" type="submit">
</form>
<?php
die;
}
|
by: ScooterMX |
last post by:
I have a page that is simply a password field. Doesn't scroll, do anything
other than accept a password, and has a submit button.
How can I automatically place the cursor in this password field when the
page loads?
I think it would be really nice to just have to type the password and hit
enter.
| |
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
|
by: Paul |
last post by:
Hi,
I'm trying to kick off the iiscnfg.vbs from a webservice to export a
website's config to an xml file (And eventually populate other servers with
the config). I initially tried this using the 1.1 framework, but discovered
that when I used Process.Start() the user's credentials were not
impersonated, it just kept using the asp.net's user, so I switched the
webservice over to 2.0 as Diagnostics.Process.StartInfo now has username,...
|
by: Niyamsan Chhaya |
last post by:
Can someone out there tell me why this script(I know-poorly written script) is not working?
<html>
<head>
<title>Password</title>
<script language="javascript">
function checkPass()
{
var pBox=window.document.input.loginname.value
|
by: Adam Wolfe |
last post by:
I am very new to HTML and I am making a web page for my father. I am trying to make a password protected page and I got that working but it will only advance to the password protected page if they click the log in button after entering the password, it will not work if they click enter I was wondering how to make this possible. Also is there a way when the password is entered that it only comes up with circles not the actual password?
here...
|
by: tutusaint |
last post by:
Hello,
I have a password reminder script in my site.
The script displays "password sent to your email address" but the email would never reach you.
Please help
<?
include 'dbb.php';
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |