Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Inherit parent directory ownership for newly added directory/files

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   

3 REPLIES 3

Re: Inherit parent directory ownership for newly added directory/files

Champion

@archit_neema

 

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

Re: Inherit parent directory ownership for newly added directory/files

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.
 
Highlighted

Re: Inherit parent directory ownership for newly added directory/files

Champion

@archit_neema

 

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