Non-superuser support with pgBackRest

pgBackRest supports non-superuser backups and restores. This feature is useful when you want to delegate backup and restore tasks to non-superusers. To configure non-superuser support, you need to grant the necessary permissions to the non-superuser.

For example, to allow the pgbackrest user to perform backups and restores, you can grant the following permissions:

grant pg_read_all_settings to pgbackrest ;

For EDB Postgres Advanced Server and PostgreSQL 14 and earlier:

GRANT EXECUTE on FUNCTION pg_switch_wal to pgbackrest;
GRANT EXECUTE ON FUNCTION pg_start_backup(text, boolean, boolean) to pgbackrest;
GRANT EXECUTE ON FUNCTION pg_stop_backup(boolean, boolean) TO pgbackrest;
GRANT EXECUTE ON FUNCTION pg_catalog.pg_create_restore_point(text) TO pgbackrest;

For Postgres Advanced Server and PostgreSQL 15 and later:

In Postgres 15 and later versions, pg_start_backup and pg_stop_backup functions are changed to pg_backup_start and pg_backup_stop. Aditionally, the pg_checkpoint role becomes available.

GRANT EXECUTE on FUNCTION pg_switch_wal to pgbackrest ;
GRANT EXECUTE ON FUNCTION pg_backup_start(label text, fast boolean) TO pgbackrest;
GRANT EXECUTE ON FUNCTION pg_backup_stop(wait_for_archive boolean) TO pgbackrest;
GRANT EXECUTE ON FUNCTION pg_catalog.pg_create_restore_point(text) TO pgbackrest;
GRANT pg_checkpoint TO pgbackrest;
Note

For versions 15 and later, EDB recommends adding the pg_checkpoint role to the non-superuser as well. This allows them to utilize the start-fast=y setting in pgBackRest, which triggers an immediate checkpoint at the start of the backup for quicker execution. Earlier versions don't include the pg_checkpoint role.


Could this page be better? Report a problem or suggest an addition!