Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)

Apache JIRA HDFS-9552 is a documentation patch that clarifies exactly what kinds of permission checks are enforced by HDFS for each kind of user operation on a file system path. This documentation is not yet live on hadoop.apache.org. I am posting the same content here in the interim until HDFS-9552 ships in an official Apache release.

Permission Checks

Each HDFS operation demands that the user has specific permissions (some combination of READ, WRITE and EXECUTE), granted through file ownership, group membership or the other permissions. An operation may perform permission checks at multiple components of the path, not only the final component. Additionally, some operations depend on a check of the owner of a path.

All operations require traversal access. Traversal access demands the EXECUTE permission on all existing components of the path, except for the final path component. For example, for any operation accessing /foo/bar/baz, the caller must have EXECUTE permission on /, /foo and /foo/bar.

The following table describes the permission checks performed by HDFS for each component of the path.

  • Ownership: Whether or not to check if the caller is the owner of the path. Typically, operations that change the ownership or permission metadata demand that the caller is the owner.
  • Parent: The parent directory of the requested path. For example, for the path /foo/bar/baz, the parent is /foo/bar.
  • Ancestor: The last existing component of the requested path. For example, for the path /foo/bar/baz, the ancestor path is /foo/bar if /foo/bar exists. The ancestor path is /foo if /foo exists but /foo/bar does not exist.
  • Final: The final component of the requested path. For example, for the path /foo/bar/baz, the final path component is /foo/bar/baz.
  • Sub-tree: For a path that is a directory, the directory itself and all of its child sub-directories, recursively. For example, for the path /foo/bar/baz, which has 2 sub-directories named buz and boo, the sub-tree is /foo/bar/baz, /foo/bar/baz/buz and /foo/bar/baz/boo.
OperationOwnershipParentAncestorFinalSub-tree
appendNON/AN/AWRITEN/A
concatNO [2]WRITE (sources)N/AREAD (sources), WRITE (destination)N/A
createNON/AWRITEWRITE [1]N/A
createSnapshotYESN/AN/AN/AN/A
deleteNO [2]WRITEN/AN/AREAD, WRITE, EXECUTE
deleteSnapshotYESN/AN/AN/AN/A
getAclStatusNON/AN/AN/AN/A
getBlockLocationsNON/AN/AREADN/A
getContentSummaryNON/AN/AN/AREAD, EXECUTE
getFileInfoNON/AN/AN/AN/A
getFileLinkInfoNON/AN/AN/AN/A
getLinkTargetNON/AN/AN/AN/A
getListingNON/AN/AREAD, EXECUTEN/A
getSnapshotDiffReportNON/AN/AREADREAD
getStoragePolicyNON/AN/AREADN/A
getXAttrsNON/AN/AREADN/A
listXAttrsNOEXECUTEN/AN/AN/A
mkdirsNON/AWRITEN/AN/A
modifyAclEntriesYESN/AN/AN/AN/A
removeAclYESN/AN/AN/AN/A
removeAclEntriesYESN/AN/AN/AN/A
removeDefaultAclYESN/AN/AN/AN/A
removeXAttrNO [2]N/AN/AWRITEN/A
renameNO [2]WRITE (source)WRITE (destination)N/AN/A
renameSnapshotYESN/AN/AN/AN/A
setAclYESN/AN/AN/AN/A
setOwnerYES [3]N/AN/AN/AN/A
setPermissionYESN/AN/AN/AN/A
setReplicationNON/AN/AWRITEN/A
setStoragePolicyNON/AN/AWRITEN/A
setTimesNON/AN/AWRITEN/A
setXAttrNO [2]N/AN/AWRITEN/A
truncateNON/AN/AWRITEN/A

[1] WRITE access on the final path component during create is only required if the call uses the overwrite option and there is an existing file at the path.

[2] Any operation that checks WRITE permission on the parent directory also checks ownership if the sticky bit is set.

[3] Calling setOwner to change the user that owns a file requires HDFS super-user access. HDFS super-user access is not required to change the group, but the caller must be a member of the specified group.

1,336 Views
Comments
Contributor

Excellent reference, thanks!

Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎02-24-2016 07:36 PM
Updated by:
 
Contributors
Top Kudoed Authors