啓動namenode服務的用戶就是超級用戶, 該用戶的組是supergroupnode
object | r | w | x | stick bit(restricted deletion flag) |
---|---|---|---|---|
file | 讀文件 | 寫或者追加寫文件 | 無效 | |
directory | 列出目錄的內容 | 建立或者刪除子文件或子目錄 | 訪問子文件或者子目錄 | 阻止移動或者刪除該目錄內的文件或目錄(超級用戶,owner和group不會被stick bit阻止) |
$ hdfs dfs -mkdir -p /input/dean $ hdfs dfs -ls / Found 3 items drwxr-xr-x - lisa supergroup 0 2015-11-08 17:26 /input drwxr-xr-x - lisa supergroup 0 2015-09-28 15:21 /test drwxr-xr-x - lisa supergroup 0 2015-11-08 17:09 /tmp $ hdfs dfs -ls /input Found 1 items drwxr-xr-x - lisa supergroup 0 2015-11-08 17:26 /input/dean
$ hdfs dfs -chown lisa:input /input $ hdfs dfs -ls / Found 3 items drwxr-xr-x - lisa input 0 2015-11-08 17:26 /input drwxr-xr-x - lisa supergroup 0 2015-09-28 15:21 /test drwxr-xr-x - lisa supergroup 0 2015-11-08 17:09 /tmp
$ hdfs dfs -ls /input Found 1 item drwxrwxr-x - dean dean 0 2015-11-21 16:24 /input/dean
注意,客戶機上建立linux 用戶dean,無需在namenode節點上建立該用戶服務器
$ hdfs dfs -chmod -R o-r /input/dean $ hdfs dfs -ls /input Found 1 items drwxrwx--x - lisa supergroup 0 2015-11-08 17:26 /input/dean $ hdfs dfs -chmod -R o-x /input/dean $ hdfs dfs -ls /input Found 1 items drwxrwx--- - lisa supergroup 0 2015-11-08 17:26 /input/dean
爲特定的用戶和組提供細緻粒度的權限管理, 而不僅是owner,group。該功能默認關閉, 須要以下設置打開spa
dfs.namenode.acls.enabled true
具體配置實在hdfs-site.xml中.net
<property> <name>dfs.permissions.enabled</name> <value>true</value> </property> <property> <name>dfs.namenode.acls.enabled</name> <value>true</value> </property>
在core-site.xml設置用戶組默認權限.rest
<property> <name>fs.permissions.umask-mode</name> <value>002</value> </property>