Thread: psql from Linux script

psql from Linux script

From
Bernard
Date:
Dear Postgresql Specialists

I am failing to update the password of the postgresql user from within
a Linux installation script run by root:

# su - postgres -c echo "ALTER USER postgres WITH PASSWORD
'newpassword';" | psql -U postgres template1
psql: FATAL:  Ident authentication failed for user "postgres"

In contrast, there is no problem with the same command issued in psql
interactively:

# su postgres
$ psql template1
template1=# ALTER USER postgres WITH PASSWORD 'newpassword';
ALTER USER
\q
$ exit
#

The client authentication configuration file pg_hba.conf is in its
original state.

I would appreciate your help very much.

Thanks.

Bernard

Re: psql from Linux script

From
Marko Kreen
Date:
On Tue, Aug 30, 2005 at 07:04:52PM +1200, Bernard wrote:
> Dear Postgresql Specialists
>
> I am failing to update the password of the postgresql user from within
> a Linux installation script run by root:
>
> # su - postgres -c echo "ALTER USER postgres WITH PASSWORD
> 'newpassword';" | psql -U postgres template1
> psql: FATAL:  Ident authentication failed for user "postgres"

I do not think the psql is ran as user postgres.

>
> In contrast, there is no problem with the same command issued in psql
> interactively:
>
> # su postgres
> $ psql template1
> template1=# ALTER USER postgres WITH PASSWORD 'newpassword';
> ALTER USER
> \q
> $ exit
> #

--
marko


Re: psql from Linux script

From
Marko Kreen
Date:
[This guy has prove-you-arent-bot filtering]

On Tue, Aug 30, 2005 at 07:04:52PM +1200, Bernard wrote:
> I would appreciate your help very much.

Unless you turn off your braindead spam-filtering, you are not worth it.

Sorry, but you are asking help on a public list, think about it a bit...

--
marko


Re: psql from Linux script

From
Devrim GUNDUZ
Date:
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-1690527636-1125390591=:6429
Content-Type: TEXT/PLAIN; charset=iso-8859-9; format=flowed
Content-Transfer-Encoding: 8BIT

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Tue, 30 Aug 2005, Marko Kreen wrote:

>> I am failing to update the password of the postgresql user from within
>> a Linux installation script run by root:
>>
>> # su - postgres -c echo "ALTER USER postgres WITH PASSWORD
>> 'newpassword';" | psql -U postgres template1
>> psql: FATAL:  Ident authentication failed for user "postgres"
>
> I do not think the psql is ran as user postgres.

Yes, this should be rewritten as:

echo "ALTER USER postgres WITH PASSWORD 'newpassword';" |su -l \
postgres -c "psql template1"

Regards,
- --
Devrim GUNDUZ
Kivi Bilişim Teknolojileri - http://www.kivi.com.tr
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                      http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDFBkBtl86P3SPfQ4RApBiAKDJY0HlXZSExl+9zXv1Q/bUL6tQAgCbBnBZ
vUxKGhAVOAFA2ia9OsBxdHc=
=1zxD
-----END PGP SIGNATURE-----
--8323328-1690527636-1125390591=:6429--

Re: psql from Linux script

From
Patrick.FICHE@AQSACOM.COM
Date:
Hi Bernard,

I just ran a test on Solaris...
The following syntax is working for me :

su - postgres -c "psql template1 -U postgres -c \"ALTER USER postgres WITH
PASSWORD 'newpassword';\""

If it can help you...

----------------------------------------------------------------------------
---------------
Patrick Fiche
email : patrick.fiche@aqsacom.com
tel : 01 69 29 36 18
----------------------------------------------------------------------------
---------------




-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Bernard
Sent: mardi 30 aout 2005 09:05
To: pgsql-general@postgresql.org
Subject: [GENERAL] psql from Linux script


Dear Postgresql Specialists

I am failing to update the password of the postgresql user from within
a Linux installation script run by root:

# su - postgres -c echo "ALTER USER postgres WITH PASSWORD
'newpassword';" | psql -U postgres template1
psql: FATAL:  Ident authentication failed for user "postgres"

In contrast, there is no problem with the same command issued in psql
interactively:

# su postgres
$ psql template1
template1=# ALTER USER postgres WITH PASSWORD 'newpassword';
ALTER USER
\q
$ exit
#

The client authentication configuration file pg_hba.conf is in its
original state.

I would appreciate your help very much.

Thanks.

Bernard

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Re: psql from Linux script

From
Bernard
Date:
Dear Marko on the Postgresql Mailing List

A whitelist based spam filtering system is simple to understand.
postgresql.org emails get through. Individual member emails may not
get through.

In contrast to what you write, it is actually the list server that is
braindead because it creates messages that have:

- A "To" header value of pgsql-general@postgresql.org
- A "From" header value of the individual sender.

So when we hit the reply button of our email client then we get the
individual sender where in fact we would prefer to get the list
address pgsql-general@postgresql.org. The list server should, if it
was reasonably functional, add a "Reply-to" header with its own
address.

I have subscribed to quite a few mailing lists before, and naturally
the first thing is to add the list server to the white list before I
even subscribe.

The postgresql.org server is the only braindead list server I have
seen so far.


On Tue, 30 Aug 2005 11:24:45 +0300, marko wrote:

>[This guy has prove-you-arent-bot filtering]
>
>On Tue, Aug 30, 2005 at 07:04:52PM +1200, Bernard wrote:
>> I would appreciate your help very much.
>
>Unless you turn off your braindead spam-filtering, you are not worth it.

It does matter to me how people value me in the context of my work.

However I have a job to do and it will get done anyway.

Meeting friendly people makes it a lot easier, and it appears that
there are plenty of friendly contributors on this list.

Try to learn from these friendly people instead of teaching me your
questionable values.

>
>Sorry, but you are asking help on a public list, think about it a bit...


Regards

Bernard

Re: psql from Linux script

From
Marko Kreen
Date:
On Tue, Aug 30, 2005 at 09:25:07PM +1200, Bernard wrote:
> The postgresql.org server is the only braindead list server I have
> seen so far.

http://www.unicom.com/pw/reply-to-harmful.html

It is the rule on technical mailing lists.

--
marko


Re: psql from Linux script

From
Peter Eisentraut
Date:
Bernard wrote:
> So when we hit the reply button of our email client then we get the
> individual sender where in fact we would prefer to get the list
> address pgsql-general@postgresql.org.

No, we would not prefer that.  If you write to me, then my reply goes to
you, no matter by what means your message was conveyed to me.

> The list server should, if it
> was reasonably functional, add a "Reply-to" header with its own
> address.

If you would like a different reply behavior activated on your posts,
then you are free to add a Mail-Followup-To header to your emails.

Re: psql from Linux script

From
Martijn van Oosterhout
Date:
On Tue, Aug 30, 2005 at 09:25:07PM +1200, Bernard wrote:
> Dear Marko on the Postgresql Mailing List
>
> A whitelist based spam filtering system is simple to understand.
> postgresql.org emails get through. Individual member emails may not
> get through.
>
> In contrast to what you write, it is actually the list server that is
> braindead because it creates messages that have:
>
> - A "To" header value of pgsql-general@postgresql.org
> - A "From" header value of the individual sender.

No, it forwards the message exactly as you sent it. If you want replies
to your message to be sent only to the group use the Reply-to or
Mail-followup-to header. See, my message says reply to me and the mail
server should not fiddle with that.

Search the web, some people say that mailing lists should never fiddle
with email headers, others say they should rewrite them completely. We
are not going to have this discussion here again, the archives are
already full of it. It is a choice and for this group this is the
better choice. Read the archives for details.

> The postgresql.org server is the only braindead list server I have
> seen so far.

Then you have not seen many. Most of the ones I'm on do it this way.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Attachment

Re: psql from Linux script

From
Greg Stark
Date:
Bernard <bht@actrix.gen.nz> writes:

> The postgresql.org server is the only braindead list server I have
> seen so far.

Well, welcome to the real Internet.

--
greg