hadoop-hdfs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Nauroth <cnaur...@hortonworks.com>
Subject Re: Get member list of group in HDFS using Java/Script
Date Fri, 19 Feb 2016 18:48:51 GMT
Hello Shashi,

HDFS itself doesn't have any knowledge of membership of users in groups.  The user and group
field of an HDFS file or directory are just arbitrary strings.  For consulting a user's group
memberships, HDFS runs a group mapping provider [1].  This is pluggable, but the common case
is either querying the underlying OS directly or querying an LDAP server.

For a given username, you can check what HDFS thinks its group memberships are by running
the "hdfs groups" command [2].  For example:

> hdfs groups chris
chris : staff everyone localaccounts _appserverusr admin _appserveradm _lpadmin _appstore
_lpoperator _developer com.apple.access_screensharing com.apple.access_ssh

However, there is no way to query a list of all users in a group through HDFS.  HDFS doesn't
have a use case for this kind of query, so it doesn't implement one.  For that, I'd expect
you'd need to query directly whatever your group membership infrastructure is (i.e. run the
"groups" command at the OS layer or query an LDAP server).

I hope this helps.

--Chris Nauroth

[1] http://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HdfsPermissionsGuide.html#Group_Mapping
[2] http://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HDFSCommands.html#groups

From: Shashi Vishwakarma <shashi.vish123@gmail.com<mailto:shashi.vish123@gmail.com>>
Date: Thursday, February 18, 2016 at 11:29 PM
To: "user@hadoop.apache.org<mailto:user@hadoop.apache.org>" <user@hadoop.apache.org<mailto:user@hadoop.apache.org>>
Subject: Get member list of group in HDFS using Java/Script


I need to find how many users belong to particular group in HDFS using Java/Script.

Let's say I have a directory /user/data in HDFS and it belongs to a group 'abc' .

I need to find how may other users belongs to 'abc' group.

Can anyone suggest something.


View raw message