Support Questions
Find answers, ask questions, and share your expertise

Inherit parent directory ownership for newly added directory/files

New Contributor

Hi All,


I'm on CDH 5.15 with Sentry enabled and also ACL enabled on the HDFS directory


Below is the use case related to HDFS directory security that I want to achieve.

1. We want to create a directory say /user/test

2. Give permission like hive:hive on /user/test

3. I will manage permission on the directory with ACL's


Now I want whenever I creates a directory/file inside /user/test with any user owner should be the same as parent i.e, hive


Please let me know how I can achieve this   





you can use -R option on the parent directory, so that it will inherit the permission recursively to the child folder. 


hdfs dfs -chown -R hive:hive /user/test


Note: you have to be super user to change ownership of any folder in hdfs

New Contributor
@saranvisaThis will change the owner only once. The requirement is, if any user creates files/folders inside the given directory, it's owner should always be the hive.




That is the reason why i've asked to use -R command


 -chown           # you are talking about this, yes it will impact only once

 -chown -R      # I am talking about this, this will triger the recursive

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.