详情页标题前

阿里云云原生大数据计算服务 MaxCompute权限命令集-云淘科技

详情页1

本文为您介绍MaxCompute项目中的权限管理命令全集,包含用户管理、角色管理、用户或角色授权、权限查看等命令。

角色管理

  • 创建角色(项目级别)
    • 命令
      create role  [privilegeproperties("type"="admin|resource")];
    • 示例
      • 创建一个Worker资源类角色,命令示例如下。
        create role Worker;
      • 创建一个sale_admin管理类角色,命令示例如下。
         create role sale_admin privilegeproperties("type"="admin");
  • 查看角色列表(项目级别)
    list roles;
  • 删除角色(项目级别)
    • 命令
      drop role ;
    • 示例
      drop role Worker;

用户管理

  • 添加阿里云账号用户(项目级别)
    • 命令
      add user ALIYUN$;
    • 示例
      add user ALIYUN$odps_test_user@aliyun.com;
  • 删除阿里云账号用户(项目级别)
    • 命令
      remove user ALIYUN$;
    • 示例
      remove user ALIYUN$odps_test_user@aliyun.com;
  • 添加RAM用户(项目级别)
    • 命令
      add user RAM$[:];
    • 示例
      add user RAM$ram_test;
      --等效于如下语句。
      add user RAM$odps_test_user@aliyun.com:ram_test;
  • 删除RAM用户(项目级别)
    • 命令
      remove user RAM$[:];
    • 示例
      remove user RAM$ram_test;
      --等效于如下语句。
      remove user RAM$odps_test_user@aliyun.com:ram_test;
  • 添加RAM角色(项目级别)
    • 命令
      add user `RAM$:role/`;
    • 示例
      add user `RAM$odps_test_user@aliyun.com:role/ram_role`;
  • 删除RAM角色(项目级别)
    • 命令
      add user RAM$[:];
    • 示例
      add user RAM$ram_test;
      --等效于如下语句。
      add user RAM$odps_test_user@aliyun.com:ram_test;
  • 查看用户列表(项目级别)
    list users;

角色授权

  • 为角色授予对象的操作权限
    • 为角色授予项目的操作权限
      • 命令
        • ACL授权
          grant Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All 
                on project  
                to ROLE  [privilegeproperties("conditions" = "", "expires"="")];
        • 通过ACL语法实现Policy授权
          grant Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All 
                on project  
                to ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}"[, "conditions"= "", "expires"=""]);
      • 示例
        --ACL授权。
        grant CreateTable, CreateFunction, CreateInstance, List on project test_project_a to ROLE Worker;
        --Policy授权。
        grant CreateTable, CreateFunction, CreateInstance, List 
              on project test_project_a  
              to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
    • 为角色授予表的操作权限
      • 命令
        • ACL授权
          grant Describe|Select|Alter|Update|Drop|ShowHistory|All 
                on table  [()] 
                to ROLE  [privilegeproperties("conditions" = "", "expires"="")];
        • 通过ACL语法实现Policy授权
          grant Describe|Select|Alter|Update|Drop|ShowHistory|All 
                on table 
        • [()] to ROLE privilegeproperties("policy" = "true", "{allow}"="{true|false}"[, "conditions"= "", "expires"=""]);
        • 示例
          --ACL授权。
          grant Describe, Select on table sale_detail to ROLE Worker;
          --Policy授权。
          grant Describe, Select  
                on table sale_detail   
                to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 为角色授予资源的操作权限
          • 命令
            • ACL授权
              grant Read|Write|Delete|All 
                    on resource  
                    to ROLE  [privilegeproperties("conditions" = "", "expires"="")];
            • 通过ACL语法实现Policy授权
              grant Read|Write|Delete|All 
                    on resource  
                    to ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}"[, "conditions"= "", "expires"=""]);
          • 示例
            --ACL授权。
            grant Read, Write on resource udtf.jar to ROLE Worker;
            --Policy授权。
            grant Read, Write   
                  on resource udtf.jar  
                  to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 为角色授予函数的操作权限
          • 命令
            grant Read|Write|Delete|Execute|All 
                  on function  
                  to ROLE  [privilegeproperties("conditions" = "", "expires"="")];
          • 示例
            --ACL授权。
            grant Read, Write on function udf_test to ROLE Worker;
            --Policy授权。
            grant Read, Write   
                  on function udf_test  
                  to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 为角色授予实例的操作权限
          • 命令
            • ACL授权
              grant Read|Write|All 
                    on instance  
                    to ROLE  [privilegeproperties("conditions" = "", "expires"="")];
            • 通过ACL语法实现Policy授权
              grant Read|Write|All  
                    on instance    
                    to ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}"[, "conditions"= "", "expires"=""]);
          • 示例
            --ACL授权。
            grant All on instance 202112300224**** to ROLE Worker;
            --Policy授权。
            grant All    
                  on instance 202112300224****   
                  to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 撤销为角色授予的对象的操作权限
          • 撤销为角色授予的项目操作权限
            • 命令
              • 撤销ACL授权
                revoke Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All 
                      on project  
                      from ROLE ;
              • 撤销Policy授权
                revoke Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All 
                      on project  
                      from ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}");
            • 示例
              --撤销ACL授权。
              revoke CreateTable, CreateFunction, CreateInstance, List on project test_project_a from ROLE Worker;
              --撤销Policy授权。
              revoke CreateTable, CreateFunction, CreateInstance, List 
                    on project test_project_a  
                    from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
          • 撤销为角色授予的表操作权限
            • 命令
              • 撤销ACL授权
                revoke Describe|Select|Alter|Update|Drop|ShowHistory|All 
                      on table 
        • [()] from ROLE ;
        • 撤销Policy授权
          revoke Describe|Select|Alter|Update|Drop|ShowHistory|All 
                on table 
        • [()] from ROLE privilegeproperties("policy" = "true", "{allow}"="{true|false}");
        • 示例
          --撤销ACL授权。
          revoke Describe, Select on table sale_detail to ROLE Worker;
          --撤销Policy授权。
          revoke Describe, Select  
                on table sale_detail   
                from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 撤销为角色授予的资源操作权限
          • 命令
            • 撤销ACL授权
              revoke Read|Write|Delete|All 
                    on resource  
                    from ROLE ;
            • 撤销Policy授权
              revoke Read|Write|Delete|All 
                    on resource  
                    from ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}");
          • 示例
            --撤销ACL授权。
            revoke Read, Write on resource udtf.jar from ROLE Worker;
            --撤销Policy授权。
            revoke Read, Write   
                  on resource udtf.jar  
                  from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 撤销为角色授予的函数操作权限
          • 命令
            • 撤销ACL授权
              revoke Read|Write|Delete|Execute|All 
                    on function  
                    from ROLE ;
            • 撤销Policy授权
              revoke Read|Write|Delete|Execute|All 
                    on function   
                    from ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}");
          • 示例
            --撤销ACL授权。
            revoke Read, Write on function udf_test from ROLE Worker;
            --撤销Policy授权。
            revoke Read, Write   
                  on function udf_test  
                  from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 撤销为角色授予的实例操作权限
          • 命令
            revoke Read|Write|All  
                  on instance    
                  from ROLE  privilegeproperties("policy" = "true", "{allow}"="{true|false}");
          • 示例
            --撤销ACL授权。
            revoke All on instance 202112300224**** from ROLE Worker;
            --撤销Policy授权。
            revoke All    
                  on instance 202112300224****   
                  from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
        • 为角色授予Download权限
          • 命令
            grant Download on {Table|Resource|Function|Instance}  to ROLE ;
            
            
          • 示例
            grant download on table sale_detail to ROLE Worker;
          • 撤销为角色授予的Download权限
            • 命令
              revoke Download on {Table|Resource|Function|Instance}  from ROLE ;
              
              
            • 示例
              revoke download on table sale_detail from ROLE Worker;
            • 为角色授予访问高敏感等级数据的权限
              • 命令
                grant Label  on table 
        • [()] to ROLE [with exp ];
        • 示例
          grant Label 4 on table sale_detail to ROLE Worker;
        • 撤销为角色授予的访问高敏感等级数据的权限
          • 命令
            revoke Label on table 
        • [()] from ROLE ;
        • 示例
          revoke Label on table sale_detail from ROLE Worker;
        • 将角色赋予用户
          • 命令
            grant  to ;
          • 示例
            grant Worker to ALIYUN$Kate@aliyun.com;
            grant Worker to RAM$Bob@aliyun.com:Allen;
        • 收回赋予用户的角色
          • 命令
            revoke  from ;
          • 示例
            revoke Worker from ALIYUN$Kate@aliyun.com;
            revoke Worker from RAM$Bob@aliyun.com:Allen;
        • 用户授权

          • 用户授权语法与示例(项目级)
            • 为用户授予项目的操作权限
              • 命令
                grant Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All
                      on project 
                      to USER  [privilegeproperties("conditions" = "",
              • 示例
                grant CreateTable, CreateFunction, CreateInstance, List on project test_project_a to user RAM$Kate@aliyun.com:Lily;
            • 为用户授予表的操作权限
              • 命令
                grant Describe|Select|Alter|Update|Drop|ShowHistory|All
                      on table 
          [()] to USER [privilegeproperties("conditions" = ""
        • 示例
          grant Describe, Select on table sale_detail to USER RAM$Bob@aliyun.com:Allen;
        • 为用户授予资源的操作权限
          • 命令
            grant Read|Write|Delete|All
                  on resource 
                  to USER  [privilegeproperties("conditions" = "",
          • 示例
            grant Read, Write on resource udtf.jar to USER RAM$Bob@aliyun.com:Alice;
        • 为用户授予函数的操作权限
          • 命令
            grant Read|Write|Delete|Execute|All
                  on function 
                  to USER  [privilegeproperties("conditions" = ""
          • 示例
            grant Read, Write on function udf_test to USER RAM$Bob@aliyun.com:Tom;
        • 为用户授予实例的操作权限
          • 命令
            grant Read|Write|All
                  on instance 
                  to USER  [privilegeproperties("conditions" = ""
          • 示例
            grant All on instance 202112300224**** to USER RAM$Bob@aliyun.com:Tom;
        • 用户授权语法与示例(项目级)
          • 撤销为用户授予的项目的操作权限
            • 命令
              revoke Read|Write|List|CreateTable|CreateInstance|CreateFunction|CreateResource|All
                    on project 
                    from USER ;
            • 示例
              revoke CreateTable, CreateFunction, CreateInstance, List on project test_project_a from user RAM$Kate@aliyun.com:Lily;
          • 撤销为用户授予的表的操作权限
            • 命令
              revoke Describe|Select|Alter|Update|Drop|ShowHistory|All
                    on table 
        • [()] from USER ;
        • 示例
          revoke Describe, Select on table sale_detail from USER RAM$Bob@aliyun.com:Allen;
        • 撤销为用户授予的资源的操作权限
          • 命令
            revoke Read|Write|Delete|All
                  on resource 
                  from USER ;
          • 示例
            revoke Read, Write on resource udtf.jar from USER RAM$Bob@aliyun.com:Alice;
        • 撤销为用户授予的函数的操作权限
          • 命令
            revoke Read|Write|Delete|Execute|All
                  on function 
                  from USER ;
          • 示例
            revoke Read, Write on function udf_test from USER RAM$Bob@aliyun.com:Tom;
        • 撤销为用户授予的实例的操作权限
          • 命令
            revoke Read|Write|All
                  on instance 
                  from USER ;
          • 示例
            revoke All on instance 202112300224**** from USER RAM$Bob@aliyun.com:Tom;
        • 用户授权语法与示例(项目级)
          • 命令

            请参见为角色授予对象的操作权限和将角色赋予用户。

          • 示例
            --为角色Worker授权。
               --ACL授权。
            grant CreateTable, CreateFunction, CreateInstance, List on project test_project_a to ROLE Worker;
               --Policy授权。
            grant CreateTable, CreateFunction, CreateInstance, List 
                  on project test_project_a  
                  to ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
            --将角色Worker赋予用户。
            grant Worker to RAM$Bob@aliyun.com:Allen;
            grant Worker to RAM$Bob@aliyun.com:Alice;
            grant Worker to RAM$Bob@aliyun.com:Tom;
        • 用户授权语法与示例(项目级)
          • 命令

            请参见撤销为角色授予的对象的操作权限或收回赋予用户的角色。

          • 示例
            --为角色Worker撤销授权。
               --撤销ACL授权。
            revoke CreateTable, CreateFunction, CreateInstance, List on project test_project_a from ROLE Worker;
               --撤销Policy授权。
            revoke CreateTable, CreateFunction, CreateInstance, List 
                  on project test_project_a  
                  from ROLE Worker privilegeproperties("policy" = "true", "allow"="true");
            --或
            --收回赋予用户的角色Worker。
            revoke Worker from RAM$Bob@aliyun.com:Allen;
        • 用户授权语法与示例(项目级)
          • 命令
            grant Download on {Table|Resource|Function|Instance}  to USER ;
            
            
          • 示例
            grant Download on table sale_detail to USER RAM$Bob@aliyun.com:Allen;
          • 用户授权语法与示例(项目级)
            • 命令
              revoke Download on {Table|Resource|Function|Instance}  from USER ;
              
              
            • 示例
              revoke Download on table sale_detail from USER RAM$Bob@aliyun.com:Allen;
            • 用户授权语法与示例(项目级)
              • 命令

                请参见为角色授予Download权限和将角色赋予用户。

              • 示例
                --创建角色Worker。
                create role Worker;
                --为角色Worker授权。
                grant download on table sale_detail to ROLE Worker;
                --将角色Worker赋予用户。
                grant Worker to RAM$Bob@aliyun.com:Allen;
                grant Worker to RAM$Bob@aliyun.com:Alice;
                grant Worker to RAM$Bob@aliyun.com:Tom;
            • 用户授权语法与示例(项目级)
              • 命令

                请参见撤销为角色授予的Download权限或收回赋予用户的角色。

              • 示例
                -为角色Worker撤销授权。
                revoke download on table sale_detail from ROLE Worker;
                --或
                --收回赋予用户的角色Worker。
                revoke Worker from RAM$Bob@aliyun.com:Allen;
            • 用户授权语法与示例(项目级)
              • 命令
                grant Label  on table 
        • [()] to USER [with exp ];
        • 示例
          grant Label 4 on table sale_detail to USER RAM$Bob@aliyun.com:Allen;
        • 用户授权语法与示例(项目级)
          • 命令
            revoke Label on table 
        • [()] from USER ;
        • 示例
          revoke Label on table sale_detail from ROLE Worker;
        • 用户授权语法与示例(项目级)
          • 命令

            请参见为角色授予访问高敏感等级数据的权限和将角色赋予用户。

          • 示例
            --创建角色Worker。
            create role Worker;
            --为角色Worker授权。
            grant Label 4 on table * to ROLE Worker;
            --将角色Worker赋予用户。
            grant Worker to RAM$Bob@aliyun.com:Allen;
            grant Worker to RAM$Bob@aliyun.com:Alice;
            grant Worker to RAM$Bob@aliyun.com:Tom;
        • 用户授权语法与示例(项目级)
          • 命令

            请参见撤销为角色授予的访问高敏感等级数据的权限或收回赋予用户的角色。

          • 示例
            -为角色Worker撤销授权。
            revoke Label on table * from ROLE Worker;
            --或
            --收回赋予用户的角色Worker。
            revoke Worker from RAM$Bob@aliyun.com:Allen;
        • 用户授权语法与示例(项目级)
          • 命令
            purge privs from user ;
          • 示例
            purge privs from user RAM$Bob@aliyun.com:Allen;
        • 查询权限信息

          查询指定角色的权限及绑定的用户信息

          查询指定角色的权限及绑定的用户信息详情请参见查询指定角色的权限及绑定的用户信息。

          • 命令
            describe role ;
          • 示例
            describe role Worker;

          查询用户的权限信息

          • 查询当前用户的权限及绑定的角色信息
            show grants;
          • 查询指定用户的权限信息和绑定的角色信息
            • 命令
              show grants for ;
            • 示例
              show grants for ALIYUN$Bob@aliyun.com;
              show grants for RAM$Bob@aliyun.com:Allen;

          查询对象的ACL授权信息

          查询对象的ACL授权信息详情请参见查询指定对象的ACL授权信息。

          • 命令
            show acl for  [on type ];
            
            
          • 示例
            show acl for test_project_a on type project;
          • 查询Label权限信息

            • 查询当前用户可访问的所有高敏感等级数据表
              show label grants;
            • 查询当前用户可访问的指定等级的高敏感数据表
              • 命令
                show label  grants;
              • 示例
                show label 2 grants;
            • 查询指定用户可访问的高敏感等级数据表
              • 命令
                show label grants for user ;
              • 示例
                show label grants for user RAM$Bob@aliyun.com:Allen;
            • 查询指定用户可访问的指定等级的高敏感数据表
              • 命令
                show label  grants for user ;
              • 示例
                show label 3 grants for user RAM$Bob@aliyun.com:Allen;
            • 查询可以访问指定敏感数据表的用户
              • 命令
                show label grants on table 
          ;
        • 示例
          show label grants on table sale_detail;
        • 查询可以访问指定敏感数据表的指定等级的用户
          • 命令
            show label  grants on table 
        • ;
        • 示例
          show label 4 grants on table sale_detail;
        • 查询指定用户在指定敏感数据表中的权限
          • 命令
            show label [
        • for user ;
        • 示例
          show label grants on table sale_detail for user RAM$Bob@aliyun.com:Allen;
        • 查询指定表中所有列的敏感等级
          • 命令
            describe 
        • ;
        • 示例
          describe sale_detail;
        • 查询Package授权信息

          • 查询指定Package的授权信息
            • 命令
              show acl for . on type package;
            • 示例
              show acl for test_project_b.datashare on type package;
          • 查询指定Package内资源的授权信息
            • 命令
              show grants on   privilegeproperties ("refobject"="true", "refproject"="", "package"="");
              
              
            • 示例
              show grants on Table sale_detail privilegeproperties ("refobject"="true", "refproject"="test_project_a", "package"="datashare");
            • 查询指定Package内表的Label授权信息
              • 命令
                show label grants on table 
          privilegeproperties ("refobject"="true", "refproject"="", "package"="");
        • 示例
          show label grants on table sale_detail privilegeproperties ("refobject"="true", "refproject"="test_project_a", "package"="datashare");
        • 查看项目空间安全配置信息

          • 项目空间数据保护
            • 开启或关闭项目空间数据保护机制
              set ProjectProtection=true|false;
            • 查看项目空间的安全配置
              show SecurityConfiguration;

              返回结果中有ProjectProtection=true|false,对应项目空间数据保护机制已开启或关闭。

          • 查看已添加的可信的项目空间
            list trustedprojects;
          • LabelSecurity权限控制策略
            • 开启或关闭LabelSecurity权限控制策略
              set LabelSecurity=true|false;
            • 查看项目空间的安全配置
              show SecurityConfiguration;

              返回结果中有LabelSecurity=true|false,对应项目空间LabelSecurity权限控制策略已开启或关闭。

          • Download权限控制功能
            • 开启或关闭Download权限控制功能
              setproject odps.security.enabledownloadprivilege=true|false;
            • 查看项目空间属性
              setproject;

              返回结果中有odps.security.enabledownloadprivilege = true|false,对应项目空间Download权限控制功能已开启或关闭。

          内容没看懂? 不太想学习?想快速解决? 有偿解决: 联系专家

          阿里云企业补贴进行中: 马上申请

          腾讯云限时活动1折起,即将结束: 马上收藏

          同尘科技为腾讯云授权服务中心。

          购买腾讯云产品享受折上折,更有现金返利:同意关联,立享优惠

          转转请注明出处:https://www.yunxiaoer.com/158132.html

          (0)
          上一篇 2023年12月10日
          下一篇 2023年12月10日
          详情页2

          相关推荐

          联系我们

          400-800-8888

          在线咨询: QQ交谈

          邮件:admin@example.com

          工作时间:周一至周五,9:30-18:30,节假日休息

          关注微信
          本站为广大会员提供阿里云、腾讯云、华为云、百度云等一线大厂的购买,续费优惠,保证底价,买贵退差。