Trik User dan Akses Postgresql
Sekedar untuk catatan lagi.
0. CHANGE PASSWORD FOR USER POSTGRES
(by default, Ubuntu don't give the password for postgres while iDempiere somehow ask dbadmin password)
sudo -u postgres psql postgres
\password postgres
1. IF WE WANT DATABASE IS ACCESSIBLE FROM REMOTE HOST
cek /etc/postgresql/[ver]/main/pg_hba.conf
host database user address auth-method [auth-options]
dan address untuk menerima semua IP = 0.0.0.0/0
auth-method disarankan md5
cek /etc/postgresql/[ver]/main/postgresql.conf
cek listen_addresses and change localhost to *
2. IF WE WANT READ-ONLY USER
CREATE USER userviewonly WITH NOCREATEDB NOCREATEROLE NOCREATEUSER PASSWORD 'p455w0rd';
CREATE USER username ENCRYPTED PASSWORD 'p455w0rd';
GRANT CONNECT ON DATABASE databasenameTO userviewonly ;
GRANT USAGE ON SCHEMA schemaname TO userviewonly ;
GRANT SELECT ON ALL TABLES IN SCHEMA schemaname TO userviewonly ;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA schemaname TO userviewonly ;
-- connect as userviewonly ;
-- SHOW search_path;
-- SET search_path TO adempiere, public;
ALTER ROLE userviewonly WITH LOGIN;
ALTER ROLE username WITH LOGIN;
-- if we want -- a role part of member another role group
GRANT group_role TO role1, ... ;
REASSIGN OWNED BY old_role [, ...] TO new_roles
-- example
ALTER ROLE username WITH SUPERUSER;
_________ some discussion _________________________________________________________
The search path that you edit using the SET command only persists for the session.
In order to persist your schema in the list of default schemas permanently,
you will have to edit the following entry in the postgresql.conf
(located at
search_path = '$user,public,sys,dbo' # schema names
Please append your schema to this list, and restart (stop/start) the database service
from your start Menu. You should now be able to refer your
without specifying schema with it.
Hope this helps...
0 comments:
Post a Comment