X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9CC9D1B56C for ; Mon, 25 Aug 2003 05:40:06 -0300 (ADT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 36415-09 for ; Mon, 25 Aug 2003 05:39:37 -0300 (ADT) Received: from ecintweb.eldocomp.com (smtp.eldocomp.com [205.159.99.8]) by svr1.postgresql.org (Postfix) with ESMTP id 735EAD1DAB4 for ; Mon, 25 Aug 2003 05:39:34 -0300 (ADT) Received: by ecintweb.eldocomp.com with XWall v3.27 ; Mon, 25 Aug 2003 01:39:10 -0700 From: "Chad R. Larson" To: Jesse Burkhardt , "pgsql-admin@postgresql.org" Subject: Re: Automated backup problems - pg_dump Date: Mon, 25 Aug 2003 01:39:42 -0700 X-Assembled-By: XWall v3.27 X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.2 Message-ID: <4.2.2.20030825013703.00c0fd28@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200308/289 X-Sequence-Number: 10010 At 03:46 PM 8/24/2003 , Jesse Burkhardt wrote: One (non-trivial) solution is to use a cron (like fcron) that allows you to= =20 set the environment of the executed process. I like fcron very much, but you'd have to be the system administer (or his= =20 cooperation) to install it. >I am sure many of you have encountered the problems I am experiencing with= =20 >automating the pg_dump command from a cron. The problem arises from a=20 >failure of this command to use the environmental variable, PG_PASSWORD.=20 >(PGUSER, on the other hand, is picked up during command execution.) The=20 >cron seems to fail completely when crontabbed as the PGSQL superuser,=20 >postgres. I do, however, get partial execution when I su to the user=20 >postgres from a cron crontabbed as root. Let me layout some relevant info: > >root orginated cron: > >30 * * * * su - postgres --command=3D"cd /var/lib/pgsql/skybuilders;=20 >/var/lib/pgsql/skybuilders/dbbackup.pl; echo `date` > timeRun.txt" > >skybuilders is a directory where I copy and dump PostgreSQL files and DBs= =20 >to be picked up by an rsync cron on an archiving machine. > >dbbackup.pl is a perl script that generates a bash shell. I will excerpt= =20 >the pertinant (failing) section of the generated script (dbbackupGenerated= .sh): > >PGUSER=3Dsomeuser >export PGUSER >PG_PASSWORD=3Dsomepassword >export PG_PASSWORD >pg_dump -o somedb > /var/lib/pgsql/skybuilders/dbbackup/somedb.dump > >When I run the script from the command line, after having su'ed into the= =20 >postgres account, this script stops at the pg_dump line waiting for a pass= word. > >Finally I will excerpt some of the final lines of my pg_hba.conf file: > ># TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE >AUTH_ARGUMENT > >#local all trust >#host all 127.0.0.1 255.255.255.255 trust > ># Using sockets credentials for improved security. Not available everywher= e, ># but works on Linux, *BSD (and probably some others) > >#local all ident sameuser > >### --> Added by JSB <-- > >local skyTemplate md5 >local sameuser md5 >local all md5 admins ># use following line to perform commands as postgres without password=20 >challenge ># local all trust > >host all 10.10.40.25 255.255.255.255 md5 > >I understand were I to change the AUTH_TYPE setting from "md5" to "trust"= =20 >the password challenge emanating from the pg_dump command will go away.=20 >However, I wish to maintain the use of md5 authentication. > >Ideas anybody? > >-- > >Jesse Burkhardt >jesse@skybuilders.com (w) 617-876-5680 >goose@aerogoose.com (h) 617-354-5523 > > > >---------------------------(end of broadcast)--------------------------- >TIP 7: don't forget to increase your free space map settings -- CONFIDENTIALITY NOTICE -- This message is intended for the sole use of the individual and entity to w= hom it is addressed, and may contain information that is privileged, confid= ential and exempt from disclosure under applicable law. If you are not the = intended addressee, nor authorized to receive for the intended addressee, y= ou are hereby notified that you may not use, copy, disclose or distribute t= o anyone the message or any information contained in the message. If you ha= ve received this message in error, please immediately advise the sender by = reply email, and delete the message. Thank you.