Hello,
I´m using PostgreSQL 7.1.2 (from Debian). My pg_hba.conf looks like
# default
local all peer sameuser
host all 127.0.0.1 255.0.0.0 ident sameuser
# added myself to cope with the problem
host all 127.0.0.1 255.0.0.0 crypt
To check, whether users can connect via crypt method I wrote a small
python script:
#!/usr/bin/python
def hello():
import sys
from pg import DB
conn = DB('test',user='testuser',passwd='test')
x = conn.query("SELECT * from testtable")
return x
print hello()
/var/log/postgresql.log shows:
Peer authentication failed for user 'testuser'
I can correctly log in on the Linux system with the testuser account
and the script works if I run it from this account *and* deleting
the passwd option from the connection string - but that´s the ident
authenification method. With password option the connection can not
be established.
Moreover I have read the postgresql docs especially auth-methods.html.
I tried to alter the pg_shadow password using
test=# alter user testuser with password 'test' ;
but I´m not sure if this works because of the strange sounding
paragraph in auth-methods.html:
Note that using alternative passwords like this means that one can no
longer use ALTER USER to change one's password. It will still appear
to work but the password one is actually changing is not the password
that the system will end up using.
I also gave those alternate passwords a try and did
/usr/lib/postgresql/bin/pg_passwd /etc/postgresql/passwd
Username: testuser
New password:
Re-enter new password:
and changed the pg_hba.conf line to
host all 127.0.0.1 255.0.0.0 crypt passwd
But nothing changed.
Can anybody help me out this trouble?
Kind regards
Andreas.