Difference between revisions of "Unode"
Jump to navigation
Jump to search
(3 intermediate revisions by the same user not shown) | |||
Line 23: | Line 23: | ||
psql -h unode-server -U agent1 -d unode | psql -h unode-server -U agent1 -d unode | ||
``` | ``` | ||
+ | |||
+ | sudo -i -u postgres psql unode | ||
+ | ``` | ||
+ | GRANT SELECT ON agents to agent1; | ||
+ | GRANT INSERT ON agents to agent1; | ||
+ | GRANT USAGE, SELECT ON SEQUENCE agents_id_seq TO agent1; | ||
+ | ``` | ||
+ | |||
+ | ``` | ||
+ | insert into agents (id, alias) VALUES (DEFAULT, 'jtest'); | ||
+ | GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO www; | ||
+ | (uuid_generate_v4() | ||
+ | |||
+ | ``` | ||
+ | |||
+ | # Ref | ||
+ | - https://www.postgresql.org/docs/current/sql-createrole.html |
Latest revision as of 04:48, 22 December 2020
sudo -i -u postgres psql
CREATE ROLE agent1 WITH LOGIN PASSWORD 'agent1' VALID UNTIL '2205-01-01'
/etc/postgresql/12/main/postgresql.conf
listen_addresses = '*'
/etc/postgresql/12/main/pg_hba.conf host all all 10.1.1.x/32 md5
sudo systemctl restart postgresql
from 10.1.1.x/32
psql -h unode-server -U agent1 -d unode
sudo -i -u postgres psql unode
GRANT SELECT ON agents to agent1; GRANT INSERT ON agents to agent1; GRANT USAGE, SELECT ON SEQUENCE agents_id_seq TO agent1;
insert into agents (id, alias) VALUES (DEFAULT, 'jtest'); GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO www; (uuid_generate_v4()