diff options
author | Julien Dessaux | 2021-03-12 18:12:41 +0100 |
---|---|---|
committer | Julien Dessaux | 2021-03-12 18:13:45 +0100 |
commit | ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7 (patch) | |
tree | cd93f66cd66f8ca6efe91882d8a46ca6b09bdc72 /content/blog/miscellaneous/postgresql-read-only.md | |
parent | Improved home speech (diff) | |
download | www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.tar.gz www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.tar.bz2 www-ed8e2b9e9ed67097d4fdc7913df1c6cd2d96d3f7.zip |
Some more articles reformatting
Diffstat (limited to 'content/blog/miscellaneous/postgresql-read-only.md')
-rw-r--r-- | content/blog/miscellaneous/postgresql-read-only.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/content/blog/miscellaneous/postgresql-read-only.md b/content/blog/miscellaneous/postgresql-read-only.md index c064e97..0b88d90 100644 --- a/content/blog/miscellaneous/postgresql-read-only.md +++ b/content/blog/miscellaneous/postgresql-read-only.md @@ -1,17 +1,18 @@ --- title: "Grant postgresql read only access" -linkTitle: "Grant postgresql read only access" date: 2015-11-24 -description: > - Grant postgresql read only access +description: How to grant read only access to a postgresql user +tags: + - PostgreSQL --- +## The solution + +Here is the bare minimum a user need in order to have complete read only access on a postgresql database : {{< highlight sh >}} GRANT CONNECT ON DATABASE "db" TO "user"; \c db GRANT USAGE ON SCHEMA public TO "user"; GRANT SELECT ON ALL TABLES IN SCHEMA public TO "user"; -ALTER DEFAULT PRIVILEGES IN SCHEMA public - GRANT SELECT ON TABLES TO "user"; +ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "user"; {{< /highlight >}} - |