What are the Least Privilege Permissions for the Database User?

System Information
  • 4.2.3:
  • Linux:
  • Postgres:
  • 16.15.0:
  • 8.5.5:

I’d like to create a database user with the least privileges possible.

Currently I create the user like this…

psql -d "postgres" -c "CREATE USER \"$APP_USER\" WITH ENCRYPTED PASSWORD '$APP_PASSWORD';"
psql -d "postgres" -c "GRANT ALL PRIVILEGES ON DATABASE $PGDATABASE TO \"$APP_USER\";"

Could I have less privileges? I feel like I’m giving the user too much :point_up:.

1 Like