Re: How to create a read only user account to access to all pg database?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Shreeyansh Dba (shreeyansh2014@xxxxxxxxx) wrote:
> A simple way is Create a user with superuser privileges and read only
> permission.
> 
> -Login psql as postgres or other superuser.
> -Create the new superuser role and set it to read only :
> 
> CREATE USER backupadmn WITH PASSWORD 'pwd' SUPERUSER ;
> ALTER USER backupadmn set default_transaction_read_only = on;

Uh, that doesn't create a read-only user, it just starts that user's
session out with the transaction being read only *by default*.

Do NOT use this to try and create read-only users.

The user can trivially change that if they have SQL access using begin:

----------------------
=# begin read write;
BEGIN
=*# alter user r1 set default_transaction_read_only = 0;
ALTER ROLE
=*# commit;
COMMIT
=# 
----------------------

Thanks!

Stephen

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux