Skip to content

Instantly share code, notes, and snippets.

@hiddentao
Last active June 14, 2020 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiddentao/10120aa606a574aa3c0c85fa0548078a to your computer and use it in GitHub Desktop.
Save hiddentao/10120aa606a574aa3c0c85fa0548078a to your computer and use it in GitHub Desktop.
Create read-only user for specific Postgres db
create user user_name with encrypted password '...';
grant connect on database "db-name" TO user_name;
grant usage on schema public to user_name;
grant select on all tables in schema public to user_name;
alter default privileges in schema public grant select on tables to user_name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment