Reply
New Contributor
Posts: 2
Registered: ‎10-18-2018

Inherit parent directory ownership for newly added directory/files

[ Edited ]

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   

Posts: 518
Topics: 14
Kudos: 87
Solutions: 45
Registered: ‎09-02-2016

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

@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

New Contributor
Posts: 2
Registered: ‎10-18-2018

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

@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.
 
Posts: 518
Topics: 14
Kudos: 87
Solutions: 45
Registered: ‎09-02-2016

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

@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

Announcements