When I tried
REVOKE ALL PRIVILEGES ON DATABASE postgres from admin;
but the user admin
is still able to connect to postgres
remotely via pgadmin
after that.
How do I completely revoke an user's access to a database?
/root$ psql -U postgres
psql (9.2.24)
Type "help" for help.
postgres=# \du
List of roles
Role name | Attributes | Member of
-----------+------------------------------------------------+-----------
admin | No inheritance | {}
postgres | Superuser, Create role, Create DB, Replication | {}
postgres=# REVOKE ALL PRIVILEGES ON DATABASE postgres from admin;
REVOKE
postgres=# SELECT * FROM pg_stat_activity;
datid | datname | pid | usesysid | usename | application_name | client_addr | client_hostname | client_port | backend_start | xact_start |
query_start | state_change | waiting | state | query
-------+----------+--------+----------+----------+------------------+-------------+-----------------+-------------+-------------------------------+-------------------------------+
-------------------------------+-------------------------------+---------+--------+---------------------------------
12924 | postgres | 121487 | 10 | postgres | psql | | | -1 | 2018-03-10 20:20:42.458031+08 | 2018-03-10 20:21:27.367078+08 |
2018-03-10 20:21:27.367078+08 | 2018-03-10 20:21:27.367082+08 | f | active | SELECT * FROM pg_stat_activity;
(1 row)
postgres=# \q
/root$ psql -U admin postgres
psql (9.2.24)
Type "help" for help.
postgres=>
You probably also need to do a
REVOKE CONNECT ON DATABASE postgres FROM PUBLIC;
Each role is an implicit member of PUBLIC.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With