pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedNeed to run pg_dump from the laptop without entering the password
10+ messages / 4 participants
[nested] [flat]
* Need to run pg_dump from the laptop without entering the password
@ 2023-10-21 15:07 M Sarwar <sarwarmd02@outlook.com>
0 siblings, 2 replies; 10+ messages in thread
From: M Sarwar @ 2023-10-21 15:07 UTC (permalink / raw)
To: pgsql-admin
Hello,
Environment:-
Database Postgres 13.7 is running from AWS RDS.
I am trying to run pg_dump from my Windows laptop which has got pgAdmin installed on it.
When I installed pgAdmin, it has pg_dump on the client side.
Now I am trying to make backup using pg_dump from my laptop. I am trying to run as Windows job from the laptop.
I need to schedule the job without entering the password.
I am going to look into scheduling job thru aws which is later and not right now.
Can you please help me in scheduling thru Windows from my laptop without entering the password?
I am having issues with entering the password while running this job.
Thanks,
Sarwar
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-21 15:18 Ron <ronljohnsonjr@gmail.com>
parent: M Sarwar <sarwarmd02@outlook.com>
1 sibling, 1 reply; 10+ messages in thread
From: Ron @ 2023-10-21 15:18 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
On 10/21/23 10:07, M Sarwar wrote:
> Hello,
>
> Environment:-
> Database Postgres 13.7 is running from AWS RDS.
> I am trying to run pg_dump from my Windows laptop which has got pgAdmin
> installed on it.
> When I installed pgAdmin, it has pg_dump on the client side.
>
> Now I am trying to make backup using pg_dump from my laptop. I am trying
> to run as Windows job from the laptop.
> I need to schedule the job without entering the password.
> I am going to look into scheduling job thru aws which is later and not
> right now.
> Can you please help me in scheduling thru Windows from my laptop without
> entering the password?
> I am having issues with entering the password while running this job.
https://www.postgresql.org/docs/15/libpq-pgpass.html
The file|.pgpass|in a user's home directory can contain passwords to be used
if the connection requires a password (and no password has been specified
otherwise). On Microsoft Windows the file is
named|%APPDATA%\postgresql\pgpass.conf|(where|%APPDATA%|refers to the
Application Data subdirectory in the user's profile).
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-21 15:24 ramsiddu007 <ramsiddu007@gmail.com>
parent: M Sarwar <sarwarmd02@outlook.com>
1 sibling, 0 replies; 10+ messages in thread
From: ramsiddu007 @ 2023-10-21 15:24 UTC (permalink / raw)
To: M Sarwar <sarwarmd02@outlook.com>; +Cc: pgsql-admin
Hey Sarwar,
Thanks for reaching out. If you want to schedule a job from your
*Windows *laptop
without entering the password, you can use the *pgpass.conf* file. This
file allows you to manage passwords for PostgreSQL connections.
Here's how you can do it:
1. Open the *pgpass.conf* file in a text editor.
2. Add a new line in the format: *hostname:port:database:username:password
or **hostname:port:*:username:password*
3. Save the file.
After setting up the* pgpass.conf* file (like
*C:\Users\<your_user_name>\AppData\Roaming\postgresql\pgpass.conf*), you
should be able to schedule the job without entering the password.
Thank you!
*Best Regards:*
Ramanna Gunde
*Don't complain about the HEAT, **PLANT A Tree*
On Sat, 21 Oct 2023 at 20:41, M Sarwar <sarwarmd02@outlook.com> wrote:
> Hello,
> Environment:-
> Database Postgres 13.7 is running from AWS RDS.
> I am trying to run pg_dump from my Windows laptop which has got pgAdmin
> installed on it.
> When I installed pgAdmin, it has pg_dump on the client side.
> Now I am trying to make backup using pg_dump from my laptop. I am trying
> to run as Windows job from the laptop.
> I need to schedule the job without entering the password.
> I am going to look into scheduling job thru aws which is later and not
> right now.
> Can you please help me in scheduling thru Windows from my laptop without
> entering the password?
> I am having issues with entering the password while running this job.
> Thanks,
> Sarwar
>
--
*Best Regards:*
Ramanna Gunde
*Don't complain about the HEAT,*
*PLANT A .*
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-22 22:31 M Sarwar <sarwarmd02@outlook.com>
parent: Ron <ronljohnsonjr@gmail.com>
0 siblings, 1 reply; 10+ messages in thread
From: M Sarwar @ 2023-10-22 22:31 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hello,
I appreciate the responses from Ron and Ramana.
Now Error Message:- "pg_dump: error: connection to database "ngbrpesb" failed: fe_sendauth: no password supplied"
File names attempted:-
1. C:\Users\N28068\AppData\Roaming\pgAdmin\pgpass.conf
2. C:\Users\N28068\AppData\Roaming\pgAdmin\.pgpass
3. C:\Users\N28068\AppData\Roaming\postgresql\pgpass.conf
4. C:\Users\N28068\AppData\Roaming\postgresql\.pgpass
A.1) On my laptop initially, I had only subdirectory called C:\Users\N28068\AppData\Roaming\pgAdmin and no sub directory called 'postgresql'.
A.2) I tried using the subdirectory pgAdmin first when pg_dump did not have success, I created sub directory postgresql under C:\Users\N28068\AppData\Roaming\
B.3) Initially, I tried to create the file pgpass.conf.
B.4) When I did not have success in the step B.3, I also tried to create a file by name .pgpass as per some of the documentation. In both cases B.3 and B.4, I am getting the same error message as stated above.
I created .pgpass file in C:\Users\N28068\AppData\Roaming\postgresql but when I run pg_dump command I got the same above error message.
I also tried using the file name pgpass.conf from the local directory, C:\Users\N28068\AppData\Roaming\postgresql and I am getting the same error message.
When pgpass.conf file did not run successfully, I changed the file name .pgpass and tried the same again.
Thanks,
Sarwar
________________________________
From: Ron <ronljohnsonjr@gmail.com>
Sent: Saturday, October 21, 2023 11:18 AM
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Need to run pg_dump from the laptop without entering the password
On 10/21/23 10:07, M Sarwar wrote:
Hello,
Environment:-
Database Postgres 13.7 is running from AWS RDS.
I am trying to run pg_dump from my Windows laptop which has got pgAdmin installed on it.
When I installed pgAdmin, it has pg_dump on the client side.
Now I am trying to make backup using pg_dump from my laptop. I am trying to run as Windows job from the laptop.
I need to schedule the job without entering the password.
I am going to look into scheduling job thru aws which is later and not right now.
Can you please help me in scheduling thru Windows from my laptop without entering the password?
I am having issues with entering the password while running this job.
https://www.postgresql.org/docs/15/libpq-pgpass.html
The file .pgpass in a user's home directory can contain passwords to be used if the connection requires a password (and no password has been specified otherwise). On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user's profile).
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-22 23:19 Erik Wienhold <ewie@ewie.name>
parent: M Sarwar <sarwarmd02@outlook.com>
0 siblings, 2 replies; 10+ messages in thread
From: Erik Wienhold @ 2023-10-22 23:19 UTC (permalink / raw)
To: M Sarwar <sarwarmd02@outlook.com>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On 2023-10-23 00:31 +0200, M Sarwar wrote:
> Now Error Message:- "pg_dump: error: connection to database "ngbrpesb" failed: fe_sendauth: no password supplied"
Could be that the hostname in pgpass.conf does not match the hostname in
the connection parameters. The hostname in pgpass.conf is
case-sensitive (not mentioned in the docs), so it must match the exact
spelling as in the connection parameters.
> File names attempted:-
>
> 1. C:\Users\N28068\AppData\Roaming\pgAdmin\pgpass.conf
> 2. C:\Users\N28068\AppData\Roaming\pgAdmin\.pgpass
> 3. C:\Users\N28068\AppData\Roaming\postgresql\pgpass.conf
Path #3 should be the correct one if user N28068 runs pg_dump. You also
wrote that you want to schedule the execution of pg_dump. Does the
scheduled job also run as that user?
--
Erik
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-22 23:55 Ron <ronljohnsonjr@gmail.com>
parent: Erik Wienhold <ewie@ewie.name>
1 sibling, 2 replies; 10+ messages in thread
From: Ron @ 2023-10-22 23:55 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On 10/22/23 18:19, Erik Wienhold wrote:
[snip]
> The hostname in pgpass.conf is
> case-sensitive (not mentioned in the docs), so it must match the exact
> spelling as in the connection parameters.
That annoys me to. no. end. Hostnames being lowercase here, uppercase
there, and mixed case somewhere else and all working just fine *except*
.pgpass regularly bites me when scripting.
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-23 01:00 Erik Wienhold <ewie@ewie.name>
parent: Ron <ronljohnsonjr@gmail.com>
1 sibling, 0 replies; 10+ messages in thread
From: Erik Wienhold @ 2023-10-23 01:00 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; +Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
On 2023-10-23 01:55 +0200, Ron wrote:
> On 10/22/23 18:19, Erik Wienhold wrote:
> [snip]
> > The hostname in pgpass.conf is
> > case-sensitive (not mentioned in the docs), so it must match the exact
> > spelling as in the connection parameters.
>
> That annoys me to. no. end. Hostnames being lowercase here, uppercase
> there, and mixed case somewhere else and all working just fine *except*
> .pgpass regularly bites me when scripting.
I know. Found a thread [1] of yours when searching for a reference
because I was sure that I read about that behavior somewhere. But
apparently it's undocumented. Here's a patch that adds a note.
[1] https://www.postgresql.org/message-id/a5b3740b-a665-7afe-052b-4382d6daf733%40gmail.com
--
Erik
Attachments:
[text/plain] v1-0001-doc-Add-note-on-case-sensitive-matching-in-passwo.patch (0B, ../../gefvvyatbss4kfwbd4hrhacnzulrolbddol2eg26lssadbdl2s@45oifatof2b3/2-v1-0001-doc-Add-note-on-case-sensitive-matching-in-passwo.patch)
download
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-23 01:27 M Sarwar <sarwarmd02@outlook.com>
parent: Erik Wienhold <ewie@ewie.name>
1 sibling, 0 replies; 10+ messages in thread
From: M Sarwar @ 2023-10-23 01:27 UTC (permalink / raw)
To: Erik Wienhold <ewie@ewie.name>; +Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hi Erik,
1. After seeing your email, I have verified another time now. It is a RDS endpoint.
I see that host naming convention followed correct. Case sensitivity is not an issue.
1. Yes, N28068 is the user. At this time, I am running the script manually. My plan is to schedule the script thru a job and the owner is going to be N28068 .
Thanks,
Sarwar
________________________________
From: Erik Wienhold <ewie@ewie.name>
Sent: Sunday, October 22, 2023 7:19 PM
To: M Sarwar <sarwarmd02@outlook.com>
Cc: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Need to run pg_dump from the laptop without entering the password
On 2023-10-23 00:31 +0200, M Sarwar wrote:
> Now Error Message:- "pg_dump: error: connection to database "ngbrpesb" failed: fe_sendauth: no password supplied"
Could be that the hostname in pgpass.conf does not match the hostname in
the connection parameters. The hostname in pgpass.conf is
case-sensitive (not mentioned in the docs), so it must match the exact
spelling as in the connection parameters.
> File names attempted:-
>
> 1. C:\Users\N28068\AppData\Roaming\pgAdmin\pgpass.conf
> 2. C:\Users\N28068\AppData\Roaming\pgAdmin\.pgpass
> 3. C:\Users\N28068\AppData\Roaming\postgresql\pgpass.conf
Path #3 should be the correct one if user N28068 runs pg_dump. You also
wrote that you want to schedule the execution of pg_dump. Does the
scheduled job also run as that user?
--
Erik
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-23 01:30 M Sarwar <sarwarmd02@outlook.com>
parent: Ron <ronljohnsonjr@gmail.com>
1 sibling, 1 reply; 10+ messages in thread
From: M Sarwar @ 2023-10-23 01:30 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hi Ron,
Yes, I have verified the host naming convention.
It is a RDS endpoint.
I see that host naming convention followed correct. Case sensitivity is not an issue.
Thanks,
Sarwar
________________________________
From: Ron <ronljohnsonjr@gmail.com>
Sent: Sunday, October 22, 2023 7:55 PM
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Need to run pg_dump from the laptop without entering the password
On 10/22/23 18:19, Erik Wienhold wrote:
[snip]
The hostname in pgpass.conf is
case-sensitive (not mentioned in the docs), so it must match the exact
spelling as in the connection parameters.
That annoys me to. no. end. Hostnames being lowercase here, uppercase there, and mixed case somewhere else and all working just fine except .pgpass regularly bites me when scripting.
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 10+ messages in thread
* Re: Need to run pg_dump from the laptop without entering the password
@ 2023-10-23 01:54 M Sarwar <sarwarmd02@outlook.com>
parent: M Sarwar <sarwarmd02@outlook.com>
0 siblings, 0 replies; 10+ messages in thread
From: M Sarwar @ 2023-10-23 01:54 UTC (permalink / raw)
To: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Hi Ron / Erik,
That did work.
1. I just corrected the file name from .pgpass to pgpass.cong.
2. While invoking pg_dump, I just added user name. Earlier, I did not give user name by thinking that it will pick up from pgpass.conf.
Thank you so much!
Sarwar
________________________________
From: M Sarwar <sarwarmd02@outlook.com>
Sent: Sunday, October 22, 2023 9:30 PM
To: Ron <ronljohnsonjr@gmail.com>; pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Need to run pg_dump from the laptop without entering the password
Hi Ron,
Yes, I have verified the host naming convention.
It is a RDS endpoint.
I see that host naming convention followed correct. Case sensitivity is not an issue.
Thanks,
Sarwar
________________________________
From: Ron <ronljohnsonjr@gmail.com>
Sent: Sunday, October 22, 2023 7:55 PM
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: Need to run pg_dump from the laptop without entering the password
On 10/22/23 18:19, Erik Wienhold wrote:
[snip]
The hostname in pgpass.conf is
case-sensitive (not mentioned in the docs), so it must match the exact
spelling as in the connection parameters.
That annoys me to. no. end. Hostnames being lowercase here, uppercase there, and mixed case somewhere else and all working just fine except .pgpass regularly bites me when scripting.
--
Born in Arizona, moved to Babylonia.
^ permalink raw reply [nested|flat] 10+ messages in thread
end of thread, other threads:[~2023-10-23 01:54 UTC | newest]
Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-10-21 15:07 Need to run pg_dump from the laptop without entering the password M Sarwar <sarwarmd02@outlook.com>
2023-10-21 15:18 ` Ron <ronljohnsonjr@gmail.com>
2023-10-22 22:31 ` M Sarwar <sarwarmd02@outlook.com>
2023-10-22 23:19 ` Erik Wienhold <ewie@ewie.name>
2023-10-22 23:55 ` Ron <ronljohnsonjr@gmail.com>
2023-10-23 01:00 ` Erik Wienhold <ewie@ewie.name>
2023-10-23 01:30 ` M Sarwar <sarwarmd02@outlook.com>
2023-10-23 01:54 ` M Sarwar <sarwarmd02@outlook.com>
2023-10-23 01:27 ` M Sarwar <sarwarmd02@outlook.com>
2023-10-21 15:24 ` ramsiddu007 <ramsiddu007@gmail.com>
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