pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Terminate connections using non-superuser
4+ messages / 3 participants
[nested] [flat]

* Terminate connections using non-superuser
@ 2017-08-02 12:36  amandeep singh <singh_a@live.in>
  0 siblings, 2 replies; 4+ messages in thread

From: amandeep singh @ 2017-08-02 12:36 UTC (permalink / raw)
  To: pgsql-admin

Hi All


I have a requirement where I need a non-superuser who can view (pg_stat_activity) and terminate (pg_terminate_backend) connections of other users. Is it possible to give such privileges to non-superuser?


Postgres Version :PostgreSQL9.6




Thanks and Regards:
Amandeep Singh

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Terminate connections using non-superuser
@ 2017-08-02 12:45  Naveen Kumar <naveenchowdaryon@gmail.com>
  parent: amandeep singh <singh_a@live.in>
  1 sibling, 1 reply; 4+ messages in thread

From: Naveen Kumar @ 2017-08-02 12:45 UTC (permalink / raw)
  To: amandeep singh <singh_a@live.in>; +Cc: pgsql-admin

Yes, non-superuser can do this. but user should have privilege to this.

GRANT pg_signal_backend TO user;

Thanks & Regards,
Naveen Kumar .M,
Sr. PostgreSQL Database Administrator,
Mobile: 7755929449.
*My attitude will always be based on how you treat me. *


On Wed, Aug 2, 2017 at 6:06 PM, amandeep singh <singh_a@live.in> wrote:

> Hi All
>
>
> I have a requirement where I need a non-superuser who can view
> (pg_stat_activity) and terminate (pg_terminate_backend) connections of
> other users. Is it possible to give such privileges to non-superuser?
>
>
> Postgres Version :PostgreSQL9.6
>
>
>
>
> Thanks and Regards:
> Amandeep Singh
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Terminate connections using non-superuser
@ 2017-08-02 12:49  Scott Mead <scottm@openscg.com>
  parent: amandeep singh <singh_a@live.in>
  1 sibling, 0 replies; 4+ messages in thread

From: Scott Mead @ 2017-08-02 12:49 UTC (permalink / raw)
  To: amandeep singh <singh_a@live.in>; +Cc: pgsql-admin

On Wed, Aug 2, 2017 at 8:36 AM, amandeep singh <singh_a@live.in> wrote:

> Hi All
>
>
> I have a requirement where I need a non-superuser who can view
> (pg_stat_activity) and terminate (pg_terminate_backend) connections of
> other users. Is it possible to give such privileges to non-superuser?
>
>
>
Create a wrapper function, my_pg_stat_activity() or
my_pg_terminate_backend()

on creation, use 'security definer'

https://www.postgresql.org/docs/9.3/static/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY

> Postgres Version :PostgreSQL9.6
>
>
>
>
> Thanks and Regards:
> Amandeep Singh
>



-- 
--
Scott Mead
Sr. Architect
*OpenSCG <http://openscg.com>*
http://openscg.com

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Terminate connections using non-superuser
@ 2017-08-03 08:05  amandeep singh <singh_a@live.in>
  parent: Naveen Kumar <naveenchowdaryon@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: amandeep singh @ 2017-08-03 08:05 UTC (permalink / raw)
  To: Naveen Kumar <naveenchowdaryon@gmail.com>; +Cc: pgsql-admin

Hi Naveen


pg_terminate_backend is working now with the solution suggested by you but I am still searching for the solution to view the queries executed by any other user using pg_stat_activity .


@scott: In my case I can't change the name of the default function/view as it is needed with the same name to run using tool.


Thanks both of you for your response.


Thanks and Regards:
Amandeep Singh
________________________________
From: Naveen Kumar <naveenchowdaryon@gmail.com>
Sent: Wednesday, August 2, 2017 6:15:27 PM
To: amandeep singh
Cc: pgsql-admin
Subject: Re: [ADMIN] Terminate connections using non-superuser

Yes, non-superuser can do this. but user should have privilege to this.

GRANT pg_signal_backend TO user;

Thanks & Regards,
Naveen Kumar .M,
Sr. PostgreSQL Database Administrator,
Mobile: 7755929449.
My attitude will always be based on how you treat me.


On Wed, Aug 2, 2017 at 6:06 PM, amandeep singh <singh_a@live.in<mailto:singh_a@live.in>> wrote:

Hi All


I have a requirement where I need a non-superuser who can view (pg_stat_activity) and terminate (pg_terminate_backend) connections of other users. Is it possible to give such privileges to non-superuser?


Postgres Version :PostgreSQL9.6




Thanks and Regards:
Amandeep Singh

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2017-08-03 08:05 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-02 12:36 Terminate connections using non-superuser amandeep singh <singh_a@live.in>
2017-08-02 12:45 ` Naveen Kumar <naveenchowdaryon@gmail.com>
2017-08-03 08:05   ` amandeep singh <singh_a@live.in>
2017-08-02 12:49 ` Scott Mead <scottm@openscg.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox