0

Based on this question and other resources, I was able to set a default server connection in pgadmin with the servers.json config file.

But when I try to open the server connection I get this error and the password is asked:

fe_sendauth: no password supplied

Without the passfile, I don't have the error (but obviously the password is asked too).


On my windows filesystem I have:
../db/servers.json
../db/servers_pass

With the following pass file:

#host:port:db:user:pass
database:5432:*:postgres:mypasswd

I first tried with a simpler passfile with only database:5432:postgres:mypasswd:postgres:mypasswd and no newline, no comment. I had the same error.

database is the name of the docker-compose image for Postgres and the name of the host (the servers.json is working and the connection to that host is fine, except for the password).


Those files are mounted in the docker compose to /pgadmin4/

volumes:
    - ../db/servers.json:/pgadmin4/servers.json
    - ../db/servers_pass:/pgadmin4/servers_pass

I can see them in the docker container

-rwxr-xr-x    1 pgadmin  pgadmin        526 Nov 18 10:22 servers.json
-rwxr-xr-x    1 root     root            57 Nov 18 11:06 servers_pass

It's a bit weird that they do not have the same owner.
I also read on other questions that permissions of the passfile needs to be 600 but how can I change that when the files are actually on the Windows filesystem?

ymoreau
  • 3,402
  • 1
  • 22
  • 60

2 Answers2

0

I'm not sure if it the same problem, but, in server mode (used with containers) the PassFile path is prefixed with the storage dir.

So, if you set your PassFile to /foo/pass, pgadmin will look for it in /var/lib/pgadmin/storage/your_user_email/foo/pass

I have created a report here

adrianlzt
  • 1,862
  • 20
  • 11
0

According to the documentation, .pgpass file (note the dot in the name):

1) should be located in home directory (in my case it is /home/pgadmin; you can check yours via eval echo ~$USER command in pgadmin's container). So volume looks like that:

`- ../db/servers_pass:/home/pgadmin/.pgpass`

2) as you correctly noticed, should have 0600 permissions. I work in Ubuntu, but what I've done is run chmod 0600 ~/.pgpass directly in the container. Because this file is a volume, container's file permissions overwrote permissions of the appropriate volume's file on the host.

After doing these steps problem disappeared.

Boolean_Type
  • 1,146
  • 3
  • 13
  • 40
  • This works, but the problem is that you can't set chmod 0600 on that file from compose.yaml (insufficient permissions) – Andrey Aug 25 '23 at 19:28