Skip to content

Instantly share code, notes, and snippets.

@sgraham785
Created February 22, 2018 06:15
Show Gist options
  • Save sgraham785/ab10353b13b3e5114acf3d7b0ef4bd9b to your computer and use it in GitHub Desktop.
Save sgraham785/ab10353b13b3e5114acf3d7b0ef4bd9b to your computer and use it in GitHub Desktop.
Postgres DB Permissions example
--ACCESS DB
REVOKE CONNECT ON DATABASE nova FROM PUBLIC;
GRANT CONNECT ON DATABASE nova TO user;
--ACCESS SCHEMA
REVOKE ALL ON SCHEMA public FROM PUBLIC;
GRANT USAGE ON SCHEMA public TO user;
--ACCESS TABLES
REVOKE ALL ON ALL TABLES IN SCHEMA public FROM PUBLIC ;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO read_only ;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO read_write ;
GRANT ALL ON ALL TABLES IN SCHEMA public TO admin ;
@sgraham785
Copy link
Author

sgraham785 commented Feb 22, 2018

OP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment