Roles and security

Started by nikhil rajover 8 years ago3 messagesgeneral
Jump to latest
#1nikhil raj
nikhilraj474@gmail.com

Hi

I am Nikhil currently working as a MS SQL DBA . Currently my company is
shifting from MS SQL to postgres

check the roles of user I want to give user roles only select, insert,
update, execute and create database to all users Permission

The users should not have these permission
drop database , delete table permission

**(Example --like in MS SQL we have like DB_roles-- ddladmin,data
writer,data reader ,etc like these do we have in postgres).***

Thanks

#2John R Pierce
pierce@hogranch.com
In reply to: nikhil raj (#1)
Re: Roles and security

On 11/25/2017 12:03 PM, nikhil raj wrote:

 check the roles of user I want to give user roles only select,
insert, update, execute and create database to all users Permission

those permissions can be assigned on a table by table basis, except
create database, thats a special permission.    if you own a database
(the creator owns it by default) then you can drop it, if you don't, you
can't.

The users should not have these permission
 drop database , delete table permission

generally the owners of objects can grant/revoke permissions on said
objects.

**(Example --like in MS SQL we have like DB_roles-- ddladmin,data
writer,data reader ,etc like these do we have in postgres).***

you could create roles like these, make users members of these roles,a
nd grant permissions to the roles.

for more information, see

https://www.postgresql.org/docs/current/static/user-manag.html
https://www.postgresql.org/docs/current/static/sql-grant.html
https://www.postgresql.org/docs/current/static/sql-revoke.html
https://www.postgresql.org/docs/current/static/sql-alterdefaultprivileges.html

--
john r pierce, recycling bits in santa cruz

#3Laurenz Albe
laurenz.albe@cybertec.at
In reply to: nikhil raj (#1)
Re: Roles and security

nikhil raj wrote:

Currently my company is shifting from MS SQL to postgres

check the roles of user I want to give user roles only select, insert, update, execute and create database to all users Permission

The users should not have these permission
drop database , delete table permission

If you want to allow a user (or role) CREATE DATABASE, give them the
CREATEDB privilege with ALTER ROLE.

If you mean "schema" when you say "database", give them the CREATE
privilege on the database instead.

SELECT, INSERT, UPDATE and EXECUTE are granted on individual objects,
not in general.

You can, however, use ALTER DEFUALT PRIVILEGES to automatically grant
privieges on any new object created.

Note that by default, everybody (the special role PUBLIC) has EXECUTE
privilege on all functions.

Only superusers and object owners are allowed DROP and ALTER on objects,
and there is no way to prevent that.

Yours,
Laurenz Albe