How to forbid non superusers to see other users in postgresql server?
ex. If currently logged in user is not a superuser then the result from
SELECT * from pg_roles;
or
\du
should be only rows with his role
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can revoke access to the authentication IDs table in the system catalogs:
Note that revoking access to
pg_rolesis not sufficient, aspg_rolesis just a view overpg_authidand it’s trivial to run the view query manually or define a new view with the same query. Theinformation_schemaviews also usepg_authiddirectly and are unaffected by revoking access topg_roles. It is not necessary to revoke access topg_rolesif you’ve revoked access topg_authid.Be aware that revoking access to global tables is still a per-database operation.
Revoking access to system catalogs may have side effects, including:
and is not generally considered supported.