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 group ownership from user (not directory)?

Solved Go to solution
Highlighted

Inherit group ownership from user (not directory)?

Rising Star

It it possible for new files/dirs to inherit group ownership from the user instead of the parent directory?

For reference this is how default group permissions are handled:

"When a file or directory is created, its owner is the user identity of the client process, and its group is the group of the parent directory (the BSD rule).”

http://hadoop.apache.org/docs/current/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.h

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: Inherit group ownership from user (not directory)?

There is currently no way for a newly created directory in HDFS to set its group from the primary group of the creating user automatically. Instead, it always follows the rule quoted in the question: the group is the group of the parent directory.

One way I've handled this in the past is first to create an intermediate directory and then explicitly change its group to the user's primary group, using chmod on the shell or setOwner in the Java APIs. Then, additional files and directories created by the process would use this as the destination directory. For example, a MapReduce job could specify its output directory under this intermediate directory, and then the output files created by that MapReduce job would have the desired group.

View solution in original post

1 REPLY 1
Highlighted

Re: Inherit group ownership from user (not directory)?

There is currently no way for a newly created directory in HDFS to set its group from the primary group of the creating user automatically. Instead, it always follows the rule quoted in the question: the group is the group of the parent directory.

One way I've handled this in the past is first to create an intermediate directory and then explicitly change its group to the user's primary group, using chmod on the shell or setOwner in the Java APIs. Then, additional files and directories created by the process would use this as the destination directory. For example, a MapReduce job could specify its output directory under this intermediate directory, and then the output files created by that MapReduce job would have the desired group.

View solution in original post

Don't have an account?
Coming from Hortonworks? Activate your account here