Thread: Cannot get a backup using a script

Cannot get a backup using a script

From
JORGE MALDONADO
Date:
I have been trying to get automated backups of a PostgreSQL database using a script without success. The error I get is "fe_sendauth: no password supplied". 

I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct information: localhot:5432:dbname:postgres:mypassword

The script I am testing is as follows:
pg_dump -E win1252 -f d:/respaldos/edocuments/edoc.backup -F p -n edocuments -h localhost -U postgres -w edocuments

I have run such a script with -W instead of -w just to test and I am asked for password and it runs correctly, so the script is fine I suppose.

I also added the following line to the script and I get the same error message:
SET PGPASSFILE="C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf"

My OS is Windows Server 2008 R2.

I will very much appreciate any help.

With respect,
Jorge Maldonado

Re: Cannot get a backup using a script

From
Albe Laurenz
Date:
JORGE MALDONADO wrote:
> I have been trying to get automated backups of a PostgreSQL database using a script without success.
> The error I get is "fe_sendauth: no password supplied".
> 
> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
> information: localhot:5432:dbname:postgres:mypassword

Is this "Username" literally?

What do you get for "echo %APPDATA%"?

The path should be %APPDATA%\postgresql\pgpass.conf

Yours,
Laurenz Albe

Re: Cannot get a backup using a script

From
JORGE MALDONADO
Date:
Thanks for your kind response.
I wrote "Username" only to show that a user name must be provided. It is actually the administrator of the domain.

If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".

I tested issuing the following command:
SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
Is there any relation between these 2 commands?

Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get the same error message.


Best regards,
Jorge Maldonado


On Thu, Nov 26, 2015 at 3:13 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
JORGE MALDONADO wrote:
> I have been trying to get automated backups of a PostgreSQL database using a script without success.
> The error I get is "fe_sendauth: no password supplied".
>
> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
> information: localhot:5432:dbname:postgres:mypassword

Is this "Username" literally?

What do you get for "echo %APPDATA%"?

The path should be %APPDATA%\postgresql\pgpass.conf

Yours,
Laurenz Albe

Re: Cannot get a backup using a script

From
Felipe Santos
Date:


2015-11-26 13:28 GMT-02:00 JORGE MALDONADO <jorgemal1960@gmail.com>:
Thanks for your kind response.
I wrote "Username" only to show that a user name must be provided. It is actually the administrator of the domain.

If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".

I tested issuing the following command:
SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
Is there any relation between these 2 commands?

Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get the same error message.


Best regards,
Jorge Maldonado


On Thu, Nov 26, 2015 at 3:13 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
JORGE MALDONADO wrote:
> I have been trying to get automated backups of a PostgreSQL database using a script without success.
> The error I get is "fe_sendauth: no password supplied".
>
> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
> information: localhot:5432:dbname:postgres:mypassword

Is this "Username" literally?

What do you get for "echo %APPDATA%"?

The path should be %APPDATA%\postgresql\pgpass.conf

Yours,
Laurenz Albe


Good afternoon Jorge,

Can you show us the backup script?

BR

Re: Cannot get a backup using a script

From
Ken Benson
Date:

 

 

 

Writes,

 

Ken Benson | Director, Development | InfoWerks Data Services, Inc. | 817.253.7867 (direct) | infowerks.com

 

From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of JORGE MALDONADO
Sent: Wednesday, November 25, 2015 11:53 AM
To: pgsql-novice@postgresql.org
Subject: [NOVICE] Cannot get a backup using a script

 

I have been trying to get automated backups of a PostgreSQL database using a script without success. The error I get is "fe_sendauth: no password supplied". 

 

I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct information: localhot:5432:dbname:postgres:mypassword

[KenB]

Is this a typo – in copying – or does your pgpass.conf actually contain localhot

It should be localhost

 

 

The script I am testing is as follows:

pg_dump -E win1252 -f d:/respaldos/edocuments/edoc.backup -F p -n edocuments -h localhost -U postgres -w edocuments

 

I have run such a script with -W instead of -w just to test and I am asked for password and it runs correctly, so the script is fine I suppose.

 

I also added the following line to the script and I get the same error message:

SET PGPASSFILE="C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf"

 

My OS is Windows Server 2008 R2.

 

I will very much appreciate any help.

 

With respect,

Jorge Maldonado

Re: Cannot get a backup using a script

From
Albe Laurenz
Date:
JORGE MALDONADO wrote:
>>> I have been trying to get automated backups of a PostgreSQL database using a script without success.
>>> The error I get is "fe_sendauth: no password supplied".
>>>
>>> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
>>> information: localhot:5432:dbname:postgres:mypassword
>> 
>> Is this "Username" literally?
>> 
>> What do you get for "echo %APPDATA%"?
>> 
>> The path should be %APPDATA%\postgresql\pgpass.conf

> I wrote "Username" only to show that a user name must be provided. It is actually the administrator of
> the domain.
> 
> If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".
> 
> I tested issuing the following command:
> SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
> 
> And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
> 
> Is there any relation between these 2 commands?
> 
> Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
> After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get
> the same error message.

You should not change APPDATA; this is set by the Windows operating system.

This environment variable changes depending on who is logged on.

Does PostgreSQL run as "Administrator" user? I hope not.

You will have to find out the value of APPDATA for the PostgreSQL user and
place pgpass.conf in %APPDATA%\postgresql of that user.

If you are confused, ask a Windows system administrator.

Yours,
Laurenz Albe

Re: Cannot get a backup using a script

From
JORGE MALDONADO
Date:
My BIG mistake !!!
Yes, the content of "pgpass.conf" file was "localhot" instead of "localhost". The script has run successfully.

I appreciate the effort of all of you who kindly invested your valuable time helping me.

Respectfully,
Jorge Maldonado


On Thu, Nov 26, 2015 at 10:24 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:
JORGE MALDONADO wrote:
>>> I have been trying to get automated backups of a PostgreSQL database using a script without success.
>>> The error I get is "fe_sendauth: no password supplied".
>>>
>>> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
>>> information: localhot:5432:dbname:postgres:mypassword
>>
>> Is this "Username" literally?
>>
>> What do you get for "echo %APPDATA%"?
>>
>> The path should be %APPDATA%\postgresql\pgpass.conf

> I wrote "Username" only to show that a user name must be provided. It is actually the administrator of
> the domain.
>
> If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".
>
> I tested issuing the following command:
> SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
>
> And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
>
> Is there any relation between these 2 commands?
>
> Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
> After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get
> the same error message.

You should not change APPDATA; this is set by the Windows operating system.

This environment variable changes depending on who is logged on.

Does PostgreSQL run as "Administrator" user? I hope not.

You will have to find out the value of APPDATA for the PostgreSQL user and
place pgpass.conf in %APPDATA%\postgresql of that user.

If you are confused, ask a Windows system administrator.

Yours,
Laurenz Albe

Re: Cannot get a backup using a script

From
Ken Benson
Date:

Be certain you change APPDATA back like it was – that’s a HUGE problem in a windows server.

 

 

Writes,

 

Ken Benson | Director, Development | InfoWerks Data Services, Inc. | 817.253.7867 (direct) | infowerks.com

 

From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of JORGE MALDONADO
Sent: Thursday, November 26, 2015 8:30 AM
To: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Cannot get a backup using a script

 

My BIG mistake !!!

Yes, the content of "pgpass.conf" file was "localhot" instead of "localhost". The script has run successfully.

 

I appreciate the effort of all of you who kindly invested your valuable time helping me.

 

Respectfully,

Jorge Maldonado

 

 

On Thu, Nov 26, 2015 at 10:24 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:

JORGE MALDONADO wrote:
>>> I have been trying to get automated backups of a PostgreSQL database using a script without success.
>>> The error I get is "fe_sendauth: no password supplied".
>>>
>>> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
>>> information: localhot:5432:dbname:postgres:mypassword
>>
>> Is this "Username" literally?
>>
>> What do you get for "echo %APPDATA%"?
>>
>> The path should be %APPDATA%\postgresql\pgpass.conf

> I wrote "Username" only to show that a user name must be provided. It is actually the administrator of
> the domain.
>
> If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".
>
> I tested issuing the following command:
> SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
>
> And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
>
> Is there any relation between these 2 commands?
>
> Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
> After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get
> the same error message.

You should not change APPDATA; this is set by the Windows operating system.

This environment variable changes depending on who is logged on.

Does PostgreSQL run as "Administrator" user? I hope not.

You will have to find out the value of APPDATA for the PostgreSQL user and
place pgpass.conf in %APPDATA%\postgresql of that user.

If you are confused, ask a Windows system administrator.

Yours,
Laurenz Albe

 

Re: Cannot get a backup using a script

From
JORGE MALDONADO
Date:
Yes, I did it already.

Thank you.

On Thu, Nov 26, 2015 at 10:32 AM, Ken Benson <Ken@infowerks.com> wrote:

Be certain you change APPDATA back like it was – that’s a HUGE problem in a windows server.

 

 

Writes,

 

Ken Benson | Director, Development | InfoWerks Data Services, Inc. | 817.253.7867 (direct) | infowerks.com

 

From: pgsql-novice-owner@postgresql.org [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of JORGE MALDONADO
Sent: Thursday, November 26, 2015 8:30 AM
To: Albe Laurenz <laurenz.albe@wien.gv.at>
Cc: pgsql-novice@postgresql.org
Subject: Re: [NOVICE] Cannot get a backup using a script

 

My BIG mistake !!!

Yes, the content of "pgpass.conf" file was "localhot" instead of "localhost". The script has run successfully.

 

I appreciate the effort of all of you who kindly invested your valuable time helping me.

 

Respectfully,

Jorge Maldonado

 

 

On Thu, Nov 26, 2015 at 10:24 AM, Albe Laurenz <laurenz.albe@wien.gv.at> wrote:

JORGE MALDONADO wrote:
>>> I have been trying to get automated backups of a PostgreSQL database using a script without success.
>>> The error I get is "fe_sendauth: no password supplied".
>>>
>>> I have a pgpass.conf in "C:\Users\Username\AppData\Roaming\postgresql\pgpass.conf" with the correct
>>> information: localhot:5432:dbname:postgres:mypassword
>>
>> Is this "Username" literally?
>>
>> What do you get for "echo %APPDATA%"?
>>
>> The path should be %APPDATA%\postgresql\pgpass.conf

> I wrote "Username" only to show that a user name must be provided. It is actually the administrator of
> the domain.
>
> If I issue the "echo %APPDATA%" command I get "c:\Users\Administrator\AppData\Roaming".
>
> I tested issuing the following command:
> SET PGPASSFILE="C:\Users\Administrator\AppData\Roaming\postgresql\pgpass.conf"
>
> And then "echo %APPDATA%" again, and I still get "c:\Users\Administrator\AppData\Roaming"
>
> Is there any relation between these 2 commands?
>
> Another test I did was to SET APPDATA="C:\Users\Adminstrator\AppData\Roaming\postgresql\pgpass.conf"
> After this, I did "echo %APPDATA%" and I get the correct path. Then I issue pg_dump but I still get
> the same error message.

You should not change APPDATA; this is set by the Windows operating system.

This environment variable changes depending on who is logged on.

Does PostgreSQL run as "Administrator" user? I hope not.

You will have to find out the value of APPDATA for the PostgreSQL user and
place pgpass.conf in %APPDATA%\postgresql of that user.

If you are confused, ask a Windows system administrator.

Yours,
Laurenz Albe

 


Last Chance to Defend Your Freedom

From
"Robert Beyne"
Date:
      Dear Fellow U.S. Citizen,

      As described in the letter below, this December, President Obama is
planning to make the U.S. a state of a global government and is taking
executive action to redistribute what we earn and own to all developing
countries worldwide.

      To keep this from happening, take action as soon as possible!

      ·         Please, read the letter below to understand what Obama and
the U.N. are plotting to do against us and what your Senators and
Representatives can do to stop him.

      ·         Forward this email unchanged to everyone you know or
otherwise can contact.

      ·         On http://www.house.gov/, enter you zip code and press Go,
or on http://www.house.gov/representatives/, click the first letter of your
state, then click on the link (their name) to your Representative’s website.
Navigate to your Representative’s contact page. Copy and paste the letter
below into your Representative’s contact page, and send it to your
Representative.

      ·         On http://www.senate.gov/senators/contact/, choose your
state, and click the link to your Senator’s website’s contact page or
website. Copy and paste the letter below into your Senator’s contact page,
and send it to your Senator.

      Your future depends on you. Make taking those steps a high priority.
Thank you.

      Here is the text of the letter …



      SUBJECT: Last Chance to Defend Our Freedom – Impeach and Imprison
Obama

      Being a U.S. citizen, it is my civic duty and honor to write to you
regarding a matter of grave national consequences.

      This December, at the 21st meeting of the U.N. Framework Convention on
Climate Change (UN FCCC) Conference of the Parties (COP-21) in Paris,
France, President Obama intends to enter the U.S., that is to enter We the
People, into a legally-binding agreement. This agreement will make the U.S.
a state of a global government; the UN FCCC COP. This global government will
make decisions that subvert our national sovereignty and the Constitution of
the United States. It will assume control of the global economy; socializing
it by monetizing greenhouse gas emission allowances and allocating those
allowances to countries worldwide. To developing countries, it will allocate
surplus allowances, but to the U.S. it will allocate less than we need to
continue our present fossil fuel usage. President Obama and the COP will
require We the People to purchase periodically increasing numbers of
allowances from developing countries; redistributing increasing amounts of
our hard earned money to foreigners through the cap-and-trade scheme that
President Obama is imposing on us through executive actions. This will cause
the price of every U.S. made product to increase, reduce our purchasing
power, and drive us into entitlement programs such as Obama’s Making Work
Pay. Furthermore, the COP will require the U.S. to revoke intellectual
property rights of U.S. industries, businesses, and citizens, to
redistribute our trade secrets and patents to developing countries where it
will be used to create industry and businesses that will take away our jobs
and dignity; also forcing us into financial hardship, heartache, and
entitlement programs. When natural disasters occur in developing countries,
instead of the citizens of those countries staying and rebuilding, the COP
will require the U.S. to take them in as environmental refugees; giving them
our land for compensation for their loss, and increasing the number of
people competing for our jobs and being given our tax dollars through
entitlement programs. Also, if all these actions and others cause the U.S.
economy to crash, developing countries and the COP will continue to take
what is ours with heartless disregard for our welfare. Obama’s and the UN
FCCC’s plans against us are criminal, malevolent, and unconscionable.

      When President Obama enters We the People into that legally-binding
agreement with the UN FCCC, you shall take action. First, Senators, for the
sake of our nation and to defend our future, reject that legally-binding
agreement with the UN FCCC. Second, for waging political and economic
warfare against We the People, that is for signing that agreement which will
oppress us under a global government and for imposing a cap-and-trade scheme
on us which will redistribute our money to the developing world, charge
President Obama with treason according to Article III. Section 3. of the
Constitution and with high crimes according to Article III. Section 4. of
the Constitution. Representatives, impeach President Obama according to
Article I. Section 2. of the Constitution and Senators, try his impeachment
and impeach him according to Article I. Section 3. of the Constitution.
Third, charge former President Obama with one count of capital theft for
each U.S. citizen whose hard-earned income has already been stolen to fund
green energy, cooperative R&D, and other projects in foreign countries and
will be stolen under the UN FCCC and through Obama’s and the UN FCCC’s
cap-and-trade scheme; so that he may be indicted, tried, judged, and
incarcerated for multiple lifetime sentences without any opportunity for
parole.

      You have a decision to make regarding your service to your state
constituency. Will you violate your oath to defend the Constitution of the
United States from all enemies foreign and domestic, ratifying its
subversion and that of our sovereignty, or will you reject further actions
subverting it; defending our Constitution and our right to freedom and
self-governance? Will you impose untold hardship and despair on We the
People, or will you bring relief and restore hope? Will you be an accomplice
to the plundering of our money, trade secrets, patents, industry,
businesses, jobs, and land, or will you protect us from fraud and theft;
rejecting any legally-binding agreement with the UN FCCC, impeaching
President Obama, and charging him for his crimes against We the People?