hadoop user file permissions

kiran picture kiran · Mar 16, 2016 · Viewed 21.4k times · Source

i have a problem in setting hadoop file permissions in hortonworks and cloudera.

My requirement is:

1. create a new user with new group  
2. create user directory in hdfs ( ex. /user/myuser )  
3. Now this folder ( in this case /user/myuser ) must be accessible to only user and its group but not other users and other groups. 

Following commands are used by me. ( in centos 6)

1.create group >>> groupadd mygroup
2. create new user who belongs to new group >>>> useradd -g mygroup myuser
3. create user directory in hdfs >>> hadoop fs -mkdir /user/myuser
4. changing ownership of the folder >>> hadoop fs -chown -R myuser:mygroup /user/myuser
5. giving permissions to user folder >>> hadoop fs -chmod -R 700 /user/myuser
6. i also changed the /tmp file permission to sticky bit. >>> hadoop fs -chmod -R 1777 /tmp

Here the problem comes, even setting this permissions the other users in other groups are accessing my data. please tell me the solution for this. I turned on hdfs file permissions by setting ( dfs.permission.enabled=true ).

Answer

cjackson picture cjackson · Mar 16, 2016

I believe you set the wrong property to enable permissions. You need to set the following property in hdfs-site:

dfs.permissions.enabled = true

This is a good resource for HDFS permissions