Discussion:
[SLE] postgresql on SuSE 10
Patrix Linux
2006-01-20 18:58:55 UTC
Permalink
Dear my friends....

I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.

I just installed the postgres and it was installed successfully. But I
can not login with psql:
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
Password for user postgres:
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
"

I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).

Please tell me, why does my postgres not run properly?

Thank you very much in advance.

this is my postgresql.conf:
=========

#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
#line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = #'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
#written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
# what IP address(es) to listen on;
listen_addresses = '192.168.1.65'
# comma-separated list of addresses;
defaults to 'localhost', '*' = all
port = 5433
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory
#per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
# octal
unix_socket_permissions = 0777
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
#password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any #keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Frank L. Parks
2006-01-20 19:12:42 UTC
Permalink
What do you have the pg_hba.conf file? That file controls security.
Post by Patrix Linux
Dear my friends....
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
I just installed the postgres and it was installed successfully. But I
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
"
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
Please tell me, why does my postgres not run properly?
Thank you very much in advance.
=========
#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
#line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = #'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
#written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
# what IP address(es) to listen on;
listen_addresses = '192.168.1.65'
Also you may want to change listen_addresses = '192.168.1.65' to
listen_addresses = '*' until you get the other stuff straighted out. It
won't lissten on 12.0.0.1 with this designation.
Post by Patrix Linux
# comma-separated list of addresses;
defaults to 'localhost', '*' = all
port = 5433
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory
#per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
# octal
unix_socket_permissions = 0777
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
#password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any #keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-20 19:20:19 UTC
Permalink
Hi, Frank... thanks for your respond. Please help me.

This is my pg_hba.conf:
acer-suse:/home/postgres/data/base/rumahsakit # cat pg_hba.conf
.......
<<CUT>>
.......
# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
#local all all md5
local all all password
# IPv4 local connections:
#host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 password
# IPv6 local connections:
#host all all ::1/128 md5
host all all ::1/128 password
acer-suse:/home/postgres/data/base/rumahsakit #
Post by Frank L. Parks
What do you have the pg_hba.conf file? That file controls security.
Post by Patrix Linux
Dear my friends....
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
I just installed the postgres and it was installed successfully. But I
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
"
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
Please tell me, why does my postgres not run properly?
Thank you very much in advance.
=========
#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
#line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = #'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
#written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
# what IP address(es) to listen on;
listen_addresses = '192.168.1.65'
Also you may want to change listen_addresses = '192.168.1.65' to
listen_addresses = '*' until you get the other stuff straighted out. It
won't lissten on 12.0.0.1 with this designation.
Post by Patrix Linux
# comma-separated list of addresses;
defaults to 'localhost', '*' = all
port = 5433
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory
#per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
# octal
unix_socket_permissions = 0777
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
#password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any #keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-21 14:32:05 UTC
Permalink
Dear my friends...

Please tell why I can not connect to my postgres.

====My login parameter from KNoda
host = localhost
database name = rumahsakit
user = root
password = <<what I use for login>>
TCP post = 5432
====My pg_hba.conf
acer-suse:/usr/local/pgsql/basisdata/rumahsakit # pwd
/usr/local/pgsql/basisdata/rumahsakit
acer-suse:/usr/local/pgsql/basisdata/rumahsakit # cat pg_hba.conf
........<<SNIP>>.........
# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all password
# IPv4 local connections:
host all all 127.0.0.1/32 password
# IPv6 local connections:
host all all ::1/128 md5
host all all 0.0.0.0 0.0.0.0 password

====The error message
Servermessage:FATAL:password authentication failed for user "root"
====my postgres.conf
acer-suse:/usr/local/pgsql/basisdata/rumahsakit # pwd
/usr/local/pgsql/basisdata/rumahsakit
acer-suse:/usr/local/pgsql/basisdata/rumahsakit # cat postgresql.conf
........<<SNIP>>..........
#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
#listen_addresses = 'localhost' # what IP address(es) to listen
on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
#unix_socket_permissions = 0777 # octal
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
#password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any
keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
.......<<SNIP>>.........

Please help me, tell me I can not connect to my postgres.

Thank you very much in advance.
Patrix,
change the last line to "host all all 0.0.0.0 0.0.0.0 password" (without
the quotes) space between .0 and the 0.
This file is only pointing to the local host and you were refusing
connections to in the other config file. Did you catch my change to the
listen parameter?
Then restart postgres.
That should do it.
Frank
Post by Patrix Linux
Hi, Frank... thanks for your respond. Please help me.
acer-suse:/home/postgres/data/base/rumahsakit # cat pg_hba.conf
.......
<<CUT>>
.......
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all md5
local all all password
#host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 password
#host all all ::1/128 md5
host all all ::1/128 password
acer-suse:/home/postgres/data/base/rumahsakit #
Post by Frank L. Parks
What do you have the pg_hba.conf file? That file controls security.
Post by Patrix Linux
Dear my friends....
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
I just installed the postgres and it was installed successfully. But I
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
"
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
Please tell me, why does my postgres not run properly?
Thank you very much in advance.
=========
#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
#line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = #'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
#written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
# what IP address(es) to listen on;
listen_addresses = '192.168.1.65'
Also you may want to change listen_addresses = '192.168.1.65' to
listen_addresses = '*' until you get the other stuff straighted out. It
won't lissten on 12.0.0.1 with this designation.
Post by Patrix Linux
# comma-separated list of addresses;
defaults to 'localhost', '*' = all
port = 5433
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory
#per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
#superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
# octal
unix_socket_permissions = 0777
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
#password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any #keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Marlier, Ian
2006-01-20 20:20:07 UTC
Permalink
-----Original Message-----
Sent: Friday, January 20, 2006 2:20 PM
Subject: Re: [SLE] postgresql on SuSE 10
Hi, Frank... thanks for your respond. Please help me.
acer-suse:/home/postgres/data/base/rumahsakit # cat pg_hba.conf
.......
<<CUT>>
.......
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
#local all all md5
local all all password
#host all all 127.0.0.1/32 md5
host all all 127.0.0.1/32 password
#host all all ::1/128 md5
host all all ::1/128 password
acer-suse:/home/postgres/data/base/rumahsakit #
This says that postgres can be accessed from the following:
- Localhost, via a file socket
- Localhost, via TCP/IP

If you want to be able to access it from anywhere else on your network,
you need to add a line like the following:

host all all aaa.bbb.ccc.ddd/32 password

(where aaa.bbb.ccc.ddd is the IP address of the machine from which
you'll be connecting.)
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Glenn Holmer
2006-01-21 10:59:03 UTC
Permalink
Post by Patrix Linux
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
To enable TCP/IP, edit /etc/sysconfig/postgresql like so:

POSTGRES_OPTIONS="-i"
Post by Patrix Linux
I just installed the postgres and it was installed successfully. But
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
To create yourself as a user, become root, then postgres:

su -
su - postgres

This necessary because postgres has an unknown password (but root can
become any user).

Now you can create yourself as a Postgres user:

psql template1
create user username password 'password'

Add "createdb" and "createuser" to the above line for superuser
privileges.

Now you can log back in as yourself and create your database:
\q [to exit psql]
exit [no longer postgres]
exit [no longer root]
psql template1
template1=# create database mydatabase;
you should see the response "CREATE DATABASE"

Make sure to switch to your database with "\c mydatabase" before adding
tables, etc., because any changes to template1 are propagated to all
newly created databases.
Post by Patrix Linux
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
I don't see that in my YaST menu... who is the owner of rumahsakit?
(type "\l" from within psql)
--
======================================================
Glenn Holmer (Linux registered user #16682)
======================================================
"Greater coherence cannot be achieved. Not even the
Netherlanders have managed this." -Anton Webern
======================================================
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-21 15:30:47 UTC
Permalink
Hi Glenn...

Here is what I did:
1. I editted my "/etc/sysconfig/postgresql" to put in the
"POSTGRES_OPTIONS="-i".
2. rcpostgresql restart.
3. I don't understand this thread:
"
Post by Glenn Holmer
su -
su - postgres
"
Here was my try but it was failed:
"
***@acer-suse:~> su
Password:
acer-suse:/home/patrix # login postgres
Password:
"
and suddenly my terminal console closed unexpectedly.

I found this line in my /etc/passwd:
"
postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
"
What is the password of the "postgres" actually? this useraccount was
created by the "postgresql-server-8.1.2-0.1.i586.rpm" as I was
installing postgresql.

Please help me further.
Post by Glenn Holmer
Post by Patrix Linux
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
POSTGRES_OPTIONS="-i"
Post by Patrix Linux
I just installed the postgres and it was installed successfully. But
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
su -
su - postgres
This necessary because postgres has an unknown password (but root can
become any user).
psql template1
create user username password 'password'
Add "createdb" and "createuser" to the above line for superuser
privileges.
\q [to exit psql]
exit [no longer postgres]
exit [no longer root]
psql template1
template1=# create database mydatabase;
you should see the response "CREATE DATABASE"
Make sure to switch to your database with "\c mydatabase" before adding
tables, etc., because any changes to template1 are propagated to all
newly created databases.
Post by Patrix Linux
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
I don't see that in my YaST menu... who is the owner of rumahsakit?
(type "\l" from within psql)
--
======================================================
Glenn Holmer (Linux registered user #16682)
======================================================
"Greater coherence cannot be achieved. Not even the
Netherlanders have managed this." -Anton Webern
======================================================
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Stuart
2006-01-21 16:14:15 UTC
Permalink
Patrix

I think what Glenn was getting you to do was this:

su -
<<enter root password at prompt>>
su - postgres <<you will not get prompted for a password>>
Post by Glenn Holmer
This necessary because postgres has an unknown password (but root can
become any user).
psql template1
This should log you into the postgresql database template1 (which comes with
postgres) and now you can use the following command.
Post by Glenn Holmer
create user username password 'password'
Add "createdb" and "createuser" to the above line for superuser
privileges.
Exit postgresql with "\q"
Post by Glenn Holmer
\q [to exit psql]
exit [no longer postgres]
exit [no longer root]
psql template1
template1=# create database mydatabase;
you should see the response "CREATE DATABASE"
Make sure to switch to your database with "\c mydatabase" before adding
tables, etc., because any changes to template1 are propagated to all
newly created databases.
Stuart
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-21 19:38:01 UTC
Permalink
Dear Stuart. Thank you very much for help.

Yes, you're very correct. once again thanks.

I can administrate my postgresql with psql now, but not with KNoda (over
TCP/IP connection).

I can not login from KNoda. The values of parameter those I used are:
"
host = localhost
database name = rumahsakit
user = patrix
password = postgres
TCP Port = 5432
".
The error message is :
"
Server message: FATAL: Ident authentication failed for user "patrix"
"

What is my mistake? please tell me.

I set my password for postgres like this:
"
rumahsakit=# alter user patrix encrypted password 'postgres';
ALTER ROLE
".
=====the postgresql.conf of "rumahsakit"
***@acer-suse:~/data/base/rumahsakit> pwd
/var/lib/pgsql/data/base/rumahsakit
***@acer-suse:~/data/base/rumahsakit> cat postgresql.conf
...<<SNIP>>...
#---------------------------------------------------------------------------
# FILE LOCATIONS
#---------------------------------------------------------------------------
# The default values of these variables are driven from the -D command
line
# switch or PGDATA environment variable, represented here as ConfigDir.
#data_directory = 'ConfigDir' # use data in another directory
#hba_file = 'ConfigDir/pg_hba.conf' # host-based authentication file
#ident_file = 'ConfigDir/pg_ident.conf' # IDENT configuration file
# If external_pid_file is not explicitly set, no extra pid file is
written.
#external_pid_file = '(none)' # write an extra pid file
#---------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
#---------------------------------------------------------------------------
# - Connection Settings -
listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses;
# defaults to 'localhost', '*' = all
port = 5432
max_connections = 150
# note: increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). You
# might also need to raise shared_buffers to support more connections.
superuser_reserved_connections = 2
#unix_socket_directory = ''
#unix_socket_group = ''
unix_socket_permissions = 0777 # octal
#bonjour_name = '' # defaults to the computer name
# - Security & Authentication -
#authentication_timeout = 60 # 1-600, in seconds
#ssl = off
password_encryption = on
#db_user_namespace = off
# Kerberos
#krb_server_keyfile = ''
#krb_srvname = 'postgres'
#krb_server_hostname = '' # empty string matches any
keytab entry
#krb_caseins_users = off
# - TCP Keepalives -
# see 'man 7 tcp' for details
#tcp_keepalives_idle = 0 # TCP_KEEPIDLE, in seconds;
# 0 selects the system default
#tcp_keepalives_interval = 0 # TCP_KEEPINTVL, in seconds;
# 0 selects the system default
#tcp_keepalives_count = 0 # TCP_KEEPCNT;
# 0 selects the system default
...<<SNIP>>...

=====my pg_hba.conf
***@acer-suse:~/data/base/rumahsakit> cat ./pg_hba.conf
...<<SNIP>>...
# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all password
# IPv4 local connections:
host all all 127.0.0.1/32 password
host all all 0.0.0.0/0.0.0.0 password
# IPv6 local connections:
host all all ::1/128 md5
Patrix
su -
<<enter root password at prompt>>
su - postgres <<you will not get prompted for a password>>
Post by Glenn Holmer
This necessary because postgres has an unknown password (but root can
become any user).
psql template1
This should log you into the postgresql database template1 (which comes with
postgres) and now you can use the following command.
Post by Glenn Holmer
create user username password 'password'
Add "createdb" and "createuser" to the above line for superuser
privileges.
Exit postgresql with "\q"
Post by Glenn Holmer
\q [to exit psql]
exit [no longer postgres]
exit [no longer root]
psql template1
template1=# create database mydatabase;
you should see the response "CREATE DATABASE"
Make sure to switch to your database with "\c mydatabase" before adding
tables, etc., because any changes to template1 are propagated to all
newly created databases.
Stuart
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Stuart
2006-01-21 21:42:30 UTC
Permalink
Patix,

Sounds like you have an entry in your pg_hba.conf file that tells psql to go
to pg_ident.conf to verify the user patrix or possibly all users. Check your
pg_hba.conf file and remove references to ident. Check any default
statements that might include ident.
Post by Patrix Linux
pg_hba.conf'
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-22 07:20:01 UTC
Permalink
Hi Stuart.

I don't find any 'ident' in my pg_hba.conf. So where is the mistake?
please keep teaching me.

====here is my pg_hba.conf
***@acer-suse:~/data/base/rumahsakit> whoami
postgres
***@acer-suse:~/data/base/rumahsakit> pwd
/var/lib/pgsql/data/base/rumahsakit
....<<SNIP>>....
# TYPE DATABASE USER CIDR-ADDRESS METHOD

# "local" is for Unix domain socket connections only
local all all password
# IPv4 local connections:
host all all 127.0.0.1/32 password
host all all 0.0.0.0 0.0.0.0 password
# IPv6 local connections:
host all all ::1/128 md5
***@acer-suse:~/data/base/rumahsakit> whoami
postgres
***@acer-suse:~/data/base/rumahsakit> pwd
/var/lib/pgsql/data/base/rumahsakit
***@acer-suse:~/data/base/rumahsakit>

====/etc/sysconfig/postgresql
***@acer-suse:/etc/sysconfig> pwd
/etc/sysconfig
***@acer-suse:/etc/sysconfig> cat postgresql
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "~postgres/data"
## ServiceRestart: postgresql
#
# In which directory should the PostgreSQL database reside?
#
POSTGRES_DATADIR="~postgres/data"

## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: ""
## ServiceRestart: postgresql
#
# The options that are given to the PostgreSQL master daemon on startup.
# See the manual pages for postmaster and postgres for valid options.
#
# Don't put "-D datadir" here since it is set by the startup script
# based on the variable POSTGRES_DATADIR above.
#
POSTGRES_OPTIONS="-i"

## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "C"
## ServiceRestart: ""
#
# Specifies the locale under which the PostgreSQL database location
# should be initialized and run. If needed, it has to be changed
# before PostgreSQL is started for the first time. To change the
# locale of an existsing PostgreSQL database location, it must be
# dumped, removed and initialized from scratch using the new locale.
#
# If unset or empty $RC_LANG from /etc/sysconfig/language is used.
#
POSTGRES_LANG=""
Post by Stuart
Patix,
Sounds like you have an entry in your pg_hba.conf file that tells psql to go
to pg_ident.conf to verify the user patrix or possibly all users. Check your
pg_hba.conf file and remove references to ident. Check any default
statements that might include ident.
Post by Patrix Linux
pg_hba.conf'
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Stuart
2006-01-22 08:49:14 UTC
Permalink
Patrix,

Now I am puzzled. The only file that I know of that would generate an ident
authentication error is the pg_hba.conf and pg_ident.conf files. If the
authentication for a particular host/user combination in the pg_hba.conf is
specified as ident <ident user> then postgres looks up that <ident user> in
the pg_ident.conf to locate the corresponding postgres user id. The only
situation I know that would generate such an error is if there is an invalid
<ident user> (one that is not in the pg_ident.conf file or the <ident user>
is left blank).

There may be a default line such as:

local all all ident sameuser

in the pg_hba.conf file that may be above the commented table headings line.
Do a grep for ident on the pg_hba.conf file to see if one shows up.

There is also a list at "pgsql-***@postgresql.org" that you can probably get
more info on this issue.
Post by Patrix Linux
Server message: FATAL: Ident authentication failed for user "patrix"
Stuart
Post by Patrix Linux
Hi Stuart.
I don't find any 'ident' in my pg_hba.conf. So where is the mistake?
please keep teaching me.
====here is my pg_hba.conf
postgres
/var/lib/pgsql/data/base/rumahsakit
....<<SNIP>>....
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all password
host all all 127.0.0.1/32 password
host all all 0.0.0.0 0.0.0.0 password
host all all ::1/128 md5
postgres
/var/lib/pgsql/data/base/rumahsakit
====/etc/sysconfig/postgresql
/etc/sysconfig
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "~postgres/data"
## ServiceRestart: postgresql
#
# In which directory should the PostgreSQL database reside?
#
POSTGRES_DATADIR="~postgres/data"
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: ""
## ServiceRestart: postgresql
#
# The options that are given to the PostgreSQL master daemon on startup.
# See the manual pages for postmaster and postgres for valid options.
#
# Don't put "-D datadir" here since it is set by the startup script
# based on the variable POSTGRES_DATADIR above.
#
POSTGRES_OPTIONS="-i"
## Path: Applications/PostgreSQL
## Description: The PostgreSQL Database System
## Type: string()
## Default: "C"
## ServiceRestart: ""
#
# Specifies the locale under which the PostgreSQL database location
# should be initialized and run. If needed, it has to be changed
# before PostgreSQL is started for the first time. To change the
# locale of an existsing PostgreSQL database location, it must be
# dumped, removed and initialized from scratch using the new locale.
#
# If unset or empty $RC_LANG from /etc/sysconfig/language is used.
#
POSTGRES_LANG=""
Post by Stuart
Patix,
Sounds like you have an entry in your pg_hba.conf file that tells psql
to go to pg_ident.conf to verify the user patrix or possibly all users.
Check your pg_hba.conf file and remove references to ident. Check any
default statements that might include ident.
Post by Patrix Linux
pg_hba.conf'
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Glenn Holmer
2006-01-22 12:49:35 UTC
Permalink
Post by Patrix Linux
Hi Stuart.
I don't find any 'ident' in my pg_hba.conf. So where is the mistake?
please keep teaching me.
====here is my pg_hba.conf
here's what I use (comments welcome...)

local template1 postgres trust
local all all md5
host all all 127.0.0.1 255.255.255.255 md5
host all all 0.0.0.0 0.0.0.0 md5
--
======================================================
Glenn Holmer (Linux registered user #16682)
======================================================
"Greater coherence cannot be achieved. Not even the
Netherlanders have managed this." -Anton Webern
======================================================
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Patrix Linux
2006-01-21 18:28:28 UTC
Permalink
Dear Glenn...

Thank you very much for yourr help...
I start to understand "su - postgres". I kept thinking about this.
And then I managed to understand it:
"
***@acer-suse:~/arsip/installer/postgreSQL8.1/dari_ftp.suse.com> su
Password:
acer-suse:/home/patrix/arsip/installer/postgreSQL8.1/dari_ftp.suse.com #
su - postgres
***@acer-suse:~> ls
backups data initlog
"
The rest, I could follow your thread very easily and I realize you gave
me a very detail steps. Thank you very much. I can administrate my
postgres and its database from psql.

Now my problem is only my KNoda still can not connect to my postgres.
Post by Glenn Holmer
Post by Patrix Linux
I am trying to config my postgres on SuSE 10 but it does not run
properly. I want to use tcp/ip connection because I am going to use
KNoda to administrate the database.
POSTGRES_OPTIONS="-i"
Post by Patrix Linux
I just installed the postgres and it was installed successfully. But
"
acer-suse:/usr/local/pgsql # psql rumahsakit
psql: FATAL: database "rumahsakit" does not exist
acer-suse:/usr/local/pgsql # psql -U postgres -W
psql: FATAL: Ident authentication failed for user "postgres"
acer-suse:/usr/local/pgsql #
su -
su - postgres
This necessary because postgres has an unknown password (but root can
become any user).
psql template1
create user username password 'password'
Add "createdb" and "createuser" to the above line for superuser
privileges.
\q [to exit psql]
exit [no longer postgres]
exit [no longer root]
psql template1
template1=# create database mydatabase;
you should see the response "CREATE DATABASE"
Make sure to switch to your database with "\c mydatabase" before adding
tables, etc., because any changes to template1 are propagated to all
newly created databases.
Post by Patrix Linux
I created the rumahsakit database from YaST2 (Miscellanous-->postgres
administration).
I don't see that in my YaST menu... who is the owner of rumahsakit?
(type "\l" from within psql)
--
======================================================
Glenn Holmer (Linux registered user #16682)
======================================================
"Greater coherence cannot be achieved. Not even the
Netherlanders have managed this." -Anton Webern
======================================================
--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-***@suse.com
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-***@suse.com
Loading...