Re: Creating a user for pg_start_backup

From: Andrew Beverley <andy(at)andybev(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating a user for pg_start_backup
Date: 2015-07-21 08:31:49
Message-ID: 1437467509.20338.16.camel@andybev.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 2015-07-21 at 16:54 +0900, Michael Paquier wrote:
> On Tue, Jul 21, 2015 at 4:47 PM, Andrew Beverley <andy(at)andybev(dot)com> wrote:
> > Dear all,
> >
> > I'm setting up hot backups on my database server. As such, I'd like to set up a
> > Postgres user that has access to only pg_start_backup and pg_stop_backup.
> >
> > I'm unable to work out how to do this with the various GRANT options. Can someone
> > point me in the right direction please? Or is there a better way to achieve this,
> > rather than having a dedicated user?
>
> Access to pg_start_backup and pg_stop_backup can be done with either a
> replication user or a superuser. You can define user with such rights
> with CREATE ROLE with the keyword REPLICATION:
> http://www.postgresql.org/docs/devel/static/sql-createrole.html

Great, thanks Michael, spot on.

For the purposes of the archives:

create user backup with password 'xxxx' replication;

I had to specify a database name when connecting:

psql -U backup -c "select pg_start_backup('Daily backup')" -d postgres

Thanks,

Andy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2015-07-21 08:46:09 Re: Creating a user for pg_start_backup
Previous Message Aviel Buskila 2015-07-21 07:56:10 Setting up HA postgresql