Обсуждение: nohup psql does not read .pgpass

Поиск
Список
Период
Сортировка

nohup psql does not read .pgpass

От
Hans Ginzel
Дата:
Hello!

Can you, please, help me determinate why psql does not read
the ~/.pgpass file when used with nohup?

echo 'select 1+1' >one.sql
psql -a --file=one.sql db    # works
time psql -a --file=one.sql db    # works
nohup psql -a --file=one.sql db    # asks for password

Environment variables are same
env >e
nohup env >ne
diff e ne
26c26
< _=/bin/env
---
> _=/usr/bin/nohup

psql --version
psql (PostgreSQL) 9.4.0
nohup --version
nohup (GNU coreutils) 8.4
cat /etc/system-release
CentOS release 6.6 (Final)

I have read and searched
http://www.postgresql.org/docs/9.4/static/app-psql.html
http://www.postgresql.org/docs/9.4/static/libpq-pgpass.html
but did not find any indices.

Regards
Hans Ginzel


Re: nohup psql does not read .pgpass

От
Hans Ginzel
Дата:
Dne 29.06.2015 10:47, Hans Ginzel napsal:

> Hello!
>
> Can you, please, help me determinate why psql does not read
> the ~/.pgpass file when used with nohup?
>
> echo 'select 1+1' >one.sql
> psql -a --file=one.sql db # works
> time psql -a --file=one.sql db # works
> nohup psql -a --file=one.sql db # asks for password

More precisely, this does not ask for password because of peer
authentication method,
but the login name to user name rewrite from .pgpass is not used.

> Environment variables are same
> env >e
> nohup env >ne
> diff e ne
> 26c26
> < _=/bin/env
> ---
>
>> _=/usr/bin/nohup
>
> psql --version
> psql (PostgreSQL) 9.4.0
> nohup --version
> nohup (GNU coreutils) 8.4
> cat /etc/system-release
> CentOS release 6.6 (Final)
>
> I have read and searched
> http://www.postgresql.org/docs/9.4/static/app-psql.html
> http://www.postgresql.org/docs/9.4/static/libpq-pgpass.html
> but did not find any indices.
>
> Regards
> Hans Ginzel


Re: nohup psql does not read .pgpass

От
Hans Ginzel
Дата:
I am sorry. The difference in the behaviour of psql command is because
psql alias versus psql binary.
The time command is bash internal which respects aliases.

HG

Dne 29.06.2015 11:11, Hans Ginzel napsal:

> Dne 29.06.2015 10:47, Hans Ginzel napsal:
>
>> Hello! Can you, please, help me determinate why psql does not read
>> the
>> ~/.pgpass file when used with nohup? echo 'select 1+1' >one.sql psql
>> -a
>> --file=one.sql db # works time psql -a --file=one.sql db # works
>> nohup
>> psql -a --file=one.sql db # asks for password
>
> More precisely, this does not ask for password because of peer
> authentication method,
> but the login name to user name rewrite from .pgpass is not used.
>
>> Environment variables are same env >e nohup env >ne diff e ne 26c26
>> <
>> _=/bin/env ---
>>
>>> _=/usr/bin/nohup
>> psql --version psql (PostgreSQL) 9.4.0 nohup --version nohup (GNU
>> coreutils) 8.4 cat /etc/system-release CentOS release 6.6 (Final) I
>> have read and searched
>> http://www.postgresql.org/docs/9.4/static/app-psql.html [1]
>> http://www.postgresql.org/docs/9.4/static/libpq-pgpass.html [2] but
>> did
>> not find any indices. Regards Hans Ginzel



Links:
------
[1] http://www.postgresql.org/docs/9.4/static/app-psql.html
[2] http://www.postgresql.org/docs/9.4/static/libpq-pgpass.html