Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the 'group' name of a Hadoop user?

Tags:

hadoop

hdfs

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)
like image 500
lixinso Avatar asked Dec 09 '22 13:12

lixinso


2 Answers

Use the command below:

$hdfs groups ksc

It gives all of the groups user ksc belongs to.

like image 60
RANJIT M Avatar answered Jan 18 '23 23:01

RANJIT M


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:

  • Change rok's file permissions to 664 (read permissions for all users), which is pretty insecure
  • Have ksc added to the hdfs group, more secure

The 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

like image 37
Ross Avatar answered Jan 18 '23 22:01

Ross