Reputation: 793
User rok
uploaded file and set the permission to 770. The file on HDFS looks like this:
-rw-rw---- 3 rok hdfs filename1
I'm using ksc
user to consume the data uploaded by rok
user. So first, I'd like to make sure that ksc
has permission for that file filename1
.
How do I find out the group name of my user ksc
? Does user belong to hdfs
group in Hadoop?
BTW, if I upload a file to Hadoop, the file permission looks like:
-rw-r--r-- 3 ksc ksc filename2
The local info on my Linux of ksc
user is :
uid=504(ksc) gid=502(ksc) groups=502(ksc)
Upvotes: 6
Views: 25463
Reputation: 339
The way that Hadoop maps users to groups is configurable, so HDFS groups may not be the same as the Unix groups. Also note that if your Hadoop configuration does use the Unix user-group mappings, it will use the unix mappings on the NameNode. Also note that the NameNode caches the mappings for a period of time, so any changes you make may not be available until the cache is expired/refreshed.
As for checking, in addition to what is already mentioned you can check the actual system file that contains the mappings like this if you have root access:
grep <user or group> /etc/group
More here: https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/GroupsMapping.html
Upvotes: 0
Reputation: 161
Use the command below:
$hdfs groups ksc
It gives all of the groups user ksc
belongs to.
Upvotes: 14
Reputation: 242
HDFS follows the traditional style of Linux file system permssions. To determine the group of ksc, use groups ksc
if you are on Linux.
-rw-rw---- 3 rok hdfs filename1
will give you read/write permissions only if you are part of the hdfs group. Judging from your output, I'm thinking you're not.
You will need to do one of the following:
664
(read permissions for all users), which is pretty insecurehdfs
group, more secureThe choice is yours...
Consult the following links for more information:
http://www.comptechdoc.org/os/linux/usersguide/linux_ugfilesp.html
https://hadoop.apache.org/docs/r1.1.1/hdfs_permissions_guide.html
Upvotes: 2