HDFS基于ACL权限控制
2017-12-19 15:11
232 查看
一、开起ACL权限开关
(1)如果是Apache Hadoop:修改hdfs-site.xml的配置,并重启
<property>
<name>dfs.namenode.acls.enabled</name>
<value>true</value>
</property>
(2)如果是CDH,登陆Cloudera Manager,选中HDFS,点击【配置】,在搜索栏中输入acl进行搜索,将【启用访问控制列表】选项选中,然后点
击【保存更改】,然后重启HDFS
二、使用shell来设置和获取文件的访问控制列表
(1)查询命令
hdfs dfs -getfacl [-R] <path>
<!-- COMMAND OPTIONS
<path>: 文件或目录路径
-R: 使用此选项可以递归地列出所有文件和目录的ACL。
-->
例如:
hdfs dfs -getfacl /data/file
(2)setfacl命令设置权限
<!-- 赋予ben用户读写/user/hdfs/file路径的权限 -->
hdfs dfs -setfacl -m user:ben:rw- /user/hdfs/file
<!-- 撤销alice用户组对/user/hdfs/file路径的ACL -->
hdfs dfs -setfacl -x user:alice /user/hdfs/file
<!-- 赋予用户user及hadoop用户读写权限,给group和others只读权限 -->
hdfs dfs -setfacl --set user::rw-,user:hadoop:rw-,group::r--,other::r-- /user/hdfs/file
注意:如果是针对hive数据库,要想用户有查询表的权限,必须将执行权限赋给当前用户即可,例如:
hdfs dfs -setfacl --set user::rwx,user:zhangsan:rwx,group::rwx,other::--- /user/hive/warehouse/mydb.db
参考:http://m.blog.csdn.net/kimsungho/article/details/51418015
(1)如果是Apache Hadoop:修改hdfs-site.xml的配置,并重启
<property>
<name>dfs.namenode.acls.enabled</name>
<value>true</value>
</property>
(2)如果是CDH,登陆Cloudera Manager,选中HDFS,点击【配置】,在搜索栏中输入acl进行搜索,将【启用访问控制列表】选项选中,然后点
击【保存更改】,然后重启HDFS
二、使用shell来设置和获取文件的访问控制列表
(1)查询命令
hdfs dfs -getfacl [-R] <path>
<!-- COMMAND OPTIONS
<path>: 文件或目录路径
-R: 使用此选项可以递归地列出所有文件和目录的ACL。
-->
例如:
hdfs dfs -getfacl /data/file
(2)setfacl命令设置权限
<!-- 赋予ben用户读写/user/hdfs/file路径的权限 -->
hdfs dfs -setfacl -m user:ben:rw- /user/hdfs/file
<!-- 撤销alice用户组对/user/hdfs/file路径的ACL -->
hdfs dfs -setfacl -x user:alice /user/hdfs/file
<!-- 赋予用户user及hadoop用户读写权限,给group和others只读权限 -->
hdfs dfs -setfacl --set user::rw-,user:hadoop:rw-,group::r--,other::r-- /user/hdfs/file
注意:如果是针对hive数据库,要想用户有查询表的权限,必须将执行权限赋给当前用户即可,例如:
hdfs dfs -setfacl --set user::rwx,user:zhangsan:rwx,group::rwx,other::--- /user/hive/warehouse/mydb.db
参考:http://m.blog.csdn.net/kimsungho/article/details/51418015
相关文章推荐
- 基于Kafka 0.9版本 使用ACL进行权限控制
- 基于AOP实现权限管理:访问控制模型RBAC和ACL
- Hadoop_Hdfs ACL 权限控制详解
- HDFS多用户管理ACL机制other权限访问控制的理解
- 基于Kafka 0.9版本 使用ACL进行权限控制
- HDFS文件权限及ACL访问控制
- 基于MVC4+EasyUI的Web开发框架形成之旅--权限控制
- C#设置与获取目录权限(.net控制ACL)
- hadoop常见问题——通过集群外服务器控制HDFS出现的permission denied权限问题
- ——基于方法的权限控制
- 【总结】基于Spring LDAP和Spring Security的用户认证和权限控制Web实现
- Spring Security(16)——基于表达式的权限控制
- 基于角色的权限控制在Drupal7中的实现
- Zookeeper的ACL权限控制
- ACL 权限控制
- 基于struts2拦截器的权限控制系统2——基于自定义JSP标签的前台html元素控制
- acl权限控制详解
- 基于SpringAOP实现数据权限控制
- 如何设计数据库表实现完整的RBAC(基于角色权限控制)
- 基于责任链模式的表单发起权限控制代码重构