pg_dumpall backup script w. ftp ; pgpass file ; after upgrade to Ubuntu 10.4 (lucid) and Postgresql 9.0.2

Started by Nonameabout 15 years ago3 messagesgeneral
Jump to latest
#1Noname
MargaretGillon@chromalloy.com

<font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><div>After a year I have restarted work on a project using Postgresql. The database I created was in Postgresql 8.2.5. I updated my database server from Ubuntu 7.10 to 10.4 (lucid)&nbsp; and installed Postgresql 9.0.2 The Postgresql install went fine and the restore from my previous pg_dumpall went fine but I have an issue with the backup script.<br><br>I have made the pgpass file as root but I cannot get the backup script to run as root I must change to a postgresql/ubuntu user engineering and then the script runs. Previously the backup script ran from cron.daily . I need to know what I am not doing correctly for this to work. I do not have much scripting experience. <br><br>The error message is <br>root@claLinus:/# source /etc/cron.daily/postgresql-backup.sh<br>pg_dumpall: could not connect to database "template1": FATAL:&nbsp; Ident authentication failed for user "engineering"<br><br><br><br>I have confirmed that .pgpass exists <br><br>root@claLinus:/# locate .pgpass<br>/home/engineering/.pgpass<br>/home/mmg/.pgpass<br>/root/.pgpass<br><br><font><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">Below is my backup script and my instructions for creating the pgpass that came from this list several years ago<br><br></font></font>Thank you for any help.<br><div>Margaret <br><br><font><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***<br></font></font>#!/bin/bash<br>#file is /etc/cron.daily/postgresql-backup.sh<br>#store the file name into a variable<br>numdate=$(date +%F)-$(date +%k%M)owl.sql<br>#remove spaces from the file name<br>numdate=${numdate/ /}<br>#backup the database<br>pg_dumpall -U engineering --column-inserts --attribute-inserts&nbsp; &gt; /tmp/$numdate<br># record in the log it was done<br>echo $(date) PID $$ backup completed &gt;&gt; /var/log/messages<br>#ftp the file<br>ftp -inv 192.168.100.29&lt;&lt;ENDFTP<br>user backupftp password<br>cd ./backupLinus/<br>lcd /tmp<br>put $numdate<br>bye<br>ENDFTP<br><br><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2"><font><font face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size="2">***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***&nbsp;***<br>#instructions for making the .pgpass file<br><br>touch ~/.pgpass<br>chmod 0600 ~/.pgpass<br>echo '*:*:*:username:password' &gt; ~/.pgpass<br>Note that this presumes you are logged in as the user who will be dumping the database(s).<br><br></font></font></font><br></div></div></font>&quot;This e-mail message and any attachment(s) are for the sole use of the intended recipient(s) and may contain company proprietary, privileged or confidential information. If you are not the intended recipient(s), please contact the sender by reply e-mail, advise them of the error and destroy this message and its attachments as well as any copies. The review, use or distribution of this message or its content by anyone other than the intended recipient or senior management of the company is strictly prohibited.&quot;<BR>

#2John R Pierce
pierce@hogranch.com
In reply to: Noname (#1)
Re: pg_dumpall backup script w. ftp ; pgpass file ; after upgrade to Ubuntu 10.4 (lucid) and Postgresql 9.0.2

On 01/21/11 11:07 AM, MargaretGillon@chromalloy.com wrote:

After a year I have restarted work on a project using Postgresql. The
database I created was in Postgresql 8.2.5. I updated my database
server from Ubuntu 7.10 to 10.4 (lucid) and installed Postgresql
9.0.2 The Postgresql install went fine and the restore from my
previous pg_dumpall went fine but I have an issue with the backup script.

I have made the pgpass file as root but I cannot get the backup script
to run as root I must change to a postgresql/ubuntu user engineering
and then the script runs. Previously the backup script ran from
cron.daily . I need to know what I am not doing correctly for this to
work. I do not have much scripting experience.

...

FATAL: Ident authentication failed for user "engineering"

that says it right there. your LOCAL authentication type is set to
IDENT in your pg_hba.conf file.

see the documentation section on Client Authentication,
http://www.postgresql.org/docs/current/static/client-authentication.html

#3Noname
MargaretGillon@chromalloy.com
In reply to: John R Pierce (#2)
Re: pg_dumpall backup script w. ftp ; pgpass file ; after upgrade to Ubuntu 10.4 (lucid) and Postgresql 9.0.2

<FONT face="Default Sans Serif,Verdana,Arial,Helvetica,sans-serif" size=2><div>&gt;&gt;&nbsp;FATAL:&nbsp;&nbsp;Ident&nbsp;authentication&nbsp;failed&nbsp;for&nbsp;user&nbsp;"engineering"<br>&gt;<br>&gt;that&nbsp;says&nbsp;it&nbsp;right&nbsp;there.&nbsp;&nbsp;your&nbsp;LOCAL&nbsp;authentication&nbsp;type&nbsp;is&nbsp;set&nbsp;to&nbsp;<br>&gt;IDENT&nbsp;in&nbsp;your&nbsp;pg_hba.conf&nbsp;file.<br>&gt;<br><br>That was it. I have updated my install documentation. <br>Thank you, <br>Margaret&nbsp;</div></FONT>&quot;This e-mail message and any attachment(s) are for the sole use of the intended recipient(s) and may contain company proprietary, privileged or confidential information. If you are not the intended recipient(s), please contact the sender by reply e-mail, advise them of the error and destroy this message and its attachments as well as any copies. The review, use or distribution of this message or its content by anyone other than the intended recipient or senior management of the company is strictly prohibited.&quot;<BR>