21.5. Default Roles
Prev | Up | Chapter 21. Database Roles | Home | Next

## 21.5. Default Roles

PostgreSQL provides a set of default roles which provide access to certain, commonly needed, privileged capabilities and information. Administrators can GRANT these roles to users and/or other roles in their environment, providing those users with access to the specified capabilities and information.

The default roles are described in Table 21.1. Note that the specific permissions for each of the default roles may change in the future as additional capabilities are added. Administrators should monitor the release notes for changes.

Table 21.1. Default Roles

Role | Allowed Access
--- | ---
pg_read_all_settings | Read all configuration variables, even those normally visible only to superusers.
pg_read_all_stats | Read all pg_stat_* views and use various statistics related extensions, even those normally visible only to superusers.
pg_stat_scan_tables | Execute monitoring functions that may take `ACCESS SHARE` locks on tables, potentially for a long time.
pg_signal_backend | Send signals to other backends (eg: cancel query, terminate).
pg_read_server_files | Allow reading files from any location the database can access on the server with COPY and other file-access functions.
pg_write_server_files | Allow writing to files in any location the database can access on the server with COPY and other file-access functions.
pg_execute_server_program | Allow executing programs on the database server as the user the database runs as with COPY and other functions which allow executing a server-side program.
pg_monitor | Read/execute various monitoring views and functions. This role is a member of `pg_read_all_settings`, `pg_read_all_stats` and `pg_stat_scan_tables`.

The `pg_read_server_files`, `pg_write_server_files` and `pg_execute_server_program` roles are intended to allow administrators to have trusted, but non-superuser, roles which are able to access files and run programs on the database server as the user the database runs as. As these roles are able to access any file on the server filesystem, they bypass all database-level permission checks when accessing files directly and they could be used to gain superuser-level access, therefore care should be taken when granting these roles to users.

The `pg_monitor`, `pg_read_all_settings`, `pg_read_all_stats` and `pg_stat_scan_tables` roles are intended to allow administrators to easily configure a role for the purpose of monitoring the database server. They grant a set of common privileges allowing the role to read various useful configuration settings, statistics and other system information normally restricted to superusers.

Care should be taken when granting these roles to ensure they are only used where needed and with the understanding that these roles grant access to privileged information.

Administrators can grant access to these roles to users using the GRANT command:

    GRANT pg_signal_backend TO admin_user;

Prev | Up | Next
21.4. Dropping Roles | Home | 21.6. Function Security