pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erick Ruiz <erick@upn.mx>
To: pgsql-admin@postgresql.org
Subject: pg_dump password
Date: Tue, 15 Jan 2008 16:56:15 -0600
Message-ID: <009301c857c9$d578b5c0$806a2140$@mx> (raw)

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

I didn't understand how to insert a password into pg_dump command line.
 
So I write this steps for insert password on pg_dump.
 
1)      Connect to postgres user
[root@]# su - postgres
 
2)      Create a .pgpass file
Bash$ vi .pgpass
 ( it contains a single line like
http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html mention it)
                *:5432:database:username:password
 
Bash$ chmod 600 .pgpass
(also I change this file to being used by postgres, with chown
postgres.postgres .pgpass, I don't know if it works with root)
 
3)      The postgres dump command line
Bash$ /usr/bin/pg_dump database > /var/lib/pgsql/backups/bkup.sql
 
For finish the test, I will put the line into a crontab or script.
 
But is the same for pg_dumpall? Or I need to create another line into
.pgpass file? I'll try.
 
Thanks
 
Lic. Erick Ruiz Rojas
 
 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)

iD8DBQFHjToOkrJZgd43jJ4RAt7CAKDKyUYI24U+U99XzEKjPgbqJGF6JwCfTsMm
BfGPBXqwcEzsUW4venBVe0c=
=wPGs
-----END PGP SIGNATURE-----

Attachments:

PGPexch.htm (text/html, 6.1K) download <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"> <head> <meta name=Generator content="Microsoft Word 12 (filtered medium)"> <style> <!-- /* Font Definitions */ @font-face {font-family:Wingdings; panose-1:5 0 0 0 0 0 0 0 0 0;} @font-face {font-family:"MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face {font-family:"MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} @font-face {font-family:"\@MS Mincho"; panose-1:2 2 6 9 4 2 5 8 3 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri","sans-serif";} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {mso-style-priority:99; color:purple; text-decoration:underline;} p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; margin-bottom:.0001pt; font-size:11.0pt; font-family:"Calibri","sans-serif";} span.EstiloCorreo17 {mso-style-type:personal-compose; font-family:"Calibri","sans-serif"; color:windowtext;} .MsoChpDefault {mso-style-type:export-only;} @page Section1 {size:612.0pt 792.0pt; margin:70.85pt 3.0cm 70.85pt 3.0cm;} div.Section1 {page:Section1;} /* List Definitions */ @list l0 {mso-list-id:868876719; mso-list-type:hybrid; mso-list-template-ids:-760981188 201981969 201981977 201981979 201981967 201981977 201981979 201981967 201981977 201981979;} @list l0:level1 {mso-level-text:"%1\)"; mso-level-tab-stop:none; mso-level-number-position:left; text-indent:-18.0pt;} @list l1 {mso-list-id:1121648719; mso-list-type:hybrid; mso-list-template-ids:181034310 1773202836 201981955 201981957 201981953 201981955 201981957 201981953 201981955 201981957;} @list l1:level1 {mso-level-start-at:2; mso-level-number-format:bullet; mso-level-text:\F0B7; mso-level-tab-stop:none; mso-level-number-position:left; margin-left:54.0pt; text-indent:-18.0pt; font-family:Symbol; mso-fareast-font-family:"MS Mincho"; mso-bidi-font-family:"Times New Roman";} ol {margin-bottom:0cm;} ul {margin-bottom:0cm;} --> </style> <!--[if gte mso 9]><xml> <o:shapedefaults v:ext="edit" spidmax="1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext="edit"> <o:idmap v:ext="edit" data="1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=ES link=blue vlink=purple> <div class=Section1> <p class=MsoNormal><span lang=EN-US>I didn&#8217;t understand how to insert a password into pg_dump command line.<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal><span lang=EN-US>So I write this steps for insert password on pg_dump.<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>1)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span lang=EN-US>Connect to postgres user<o:p></o:p></span></p> <p class=MsoListParagraph><span lang=EN-US>[root@]# su &#8211; postgres<o:p></o:p></span></p> <p class=MsoListParagraph><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>2)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span lang=EN-US>Create a .pgpass file (into postgres session)<o:p></o:p></span></p> <p class=MsoListParagraph><span lang=EN-US>Bash$ vi .pgpass<o:p></o:p></span></p> <p class=MsoListParagraph><span lang=EN-US>&nbsp;( it contains a single line like <a href="http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html">http://www.postgresql.org/docs/8.2/interactive/libpq-pgpass.html</a> mention it)<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *:5432:database:username:password<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>Bash$ chmod 600 .pgpass<o:p></o:p></span></p> <p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US>(also I change this file to being used by postgres, with chown postgres.postgres .pgpass, I don&#8217;t know if it works with root)<o:p></o:p></span></p> <p class=MsoNormal style='text-indent:35.4pt'><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l0 level1 lfo1'><![if !supportLists]><span lang=EN-US><span style='mso-list:Ignore'>3)<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></span><![endif]><span lang=EN-US>The postgres dump command line<o:p></o:p></span></p> <p class=MsoListParagraph><span lang=EN-US>Bash$ /usr/bin/pg_dump database &gt; /var/lib/pgsql/backups/bkup.sql<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal><span lang=EN-US>For finish the test, I will put the line into a crontab or script.<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal><span lang=EN-US>But is the same for pg_dumpall? Or I need to create another line into .pgpass file? I&#8217;ll try.<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal><span lang=EN-US>Thanks<o:p></o:p></span></p> <p class=MsoNormal><span lang=EN-US><o:p>&nbsp;</o:p></span></p> <p class=MsoNormal>Lic. Erick Ruiz Rojas<o:p></o:p></p> <p class=MsoNormal><o:p>&nbsp;</o:p></p> <p class=MsoNormal><o:p>&nbsp;</o:p></p> </div> </body> </html>
PGPexch.htm.asc (application/pgp-signature, 186B) download

Message-ID: <009301c857c9$d578b5c0$806a2140$@mx>
Permalink:  ../009301c857c9$d578b5c0$806a2140$@mx/
Also on:    postgresql.org/message-id/009301c857c9$d578b5c0$806a2140$@mx

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: erick@upn.mx
  Subject: Re: pg_dump password
  In-Reply-To: <009301c857c9$d578b5c0$806a2140$@mx>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox