首页 文章 精选 留言 我的

精选列表

搜索[postgres],共1363篇文章
优秀的个人博客,低调大师

阿里云rds postgres回收用户权限

1,提工单由于当初设计都是用的public schema,而public schema对所有用户权限没有限制,所以需要回收部分用户的建表权限,=> dn List of schemas Name Owner public pg2490375 而public 默认owner是初始化实列的用户,所以提供单将public owner改成自己建的用户将test,template1数据库public schema的owner给xhc_test 。=> dn List of schemas Name Owner public xhc_test 2,若为rds_superuser 则改为nords_superuserxhc_dba=> alter user xhc_rw nords_superuser; 3,回收create 权限xhc_dba=> revoke create on schema public from public;xhc_dba=> c - xhc_rw;You are now connected to database "xhc_dba" as user "xhc_rw”. —回收成功xhc_dba=> create table t000(id serial,id2 bigint);ERROR: permission denied for schema publicxhc_dba=> 注1单单回收某个用户的create权限是没有用的,必须回收public的create权限,hc_dba=> revoke create on schema public from xhc_rw;REVOKexhc_dba=> c - xhc_rw;You are now connected to database "xhc_dba" as user "xhc_rw".xhc_dba=> create t000(id bigint,id2 serial primary key);xhc_dba=> create table t000(id bigint,id2 serial primary key);CREATE TABLExhc_dba=> 注2xhc_dba=> cpsql (9.5.2, server 9.4.10)You are now connected to database "xhc_dba" as user "xhc_rw".xhc_dba=> d List of relations Schema Name Type Owner public t000 table xhc_rw xhc_dba=> drop table t000;虽然回收了xhc_rw的create权限,但是xhc_rw对以前建的表还是有ddl,权限的 注3hc_dba=> cpsql (9.5.2, server 9.4.10)You are now connected to database "xhc_dba" as user "xhc_test".xhc_dba=> dn List of schemas Name Owner public xhc_test xhc_dba=> d Schema Name Type Owner public t11 table xhc_rw xhc_dba=> alter table t11 owner to xhc_test;ALTER TABLExhc_dba=> alter table t11 owner to xhc_rw;ERROR: permission denied for schema public因为回收了所有用户的create权限,所以表的所属权是不可逆的,原来属于xhc_rw的表改成xhc_test之后就不能再改回来了 要想以后xhc_rw对不属于自己的表也有读写权限需要执行以下4句 grant select,insert,update,delete on all tables in schema public to xhc_rw;WARNING: no privileges were granted for “test” —因为test表本来就属于xhc_rw用户,所以会有警告,如果把test 表owner改成xhc_test就不会有警告了xhc_dba=> grant select,usage on all sequences in schema public to xhc_rw;GRANTxhc_dba=> alter default privileges in schema public grant select,update,delete,insert on tables to xhc_rw;ALTER DEFAULT PRIVILEGESxhc_dba=> alter default privileges in schema public grant select,usage on sequences to xhc_rw;ALTER DEFAULT PRIVILEGES

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册