Hi Brian, 

I believe dfs -rmr does check the permission for each file.
What's allowing you to delete other users data is the trash feature. 
Each user's Trash is expunged by the namenode process, which is a
superuser.
More discussion on 
(http://issues.apache.org/jira/browse/HADOOP-2514)

My guess is, what we really need is a 'sticky bit' that won't allow dfs
-mv for files/directories under a dir with 777 permission.  I couldn't
find a Jira so opened a new one. 
https://issues.apache.org/jira/browse/HADOOP-3953

Koji

===========================================
(userB)> hadoop dfs -ls / | grep ' /tmp'
drwxrwxrwx   - knoguchi supergroup          0 2008-08-14 16:47 /tmp

(userB)> hadoop dfs -Dfs.trash.interval=0 -ls /tmp
Found 1 items
drwxr-xr-x   - userA users          0 2008-08-14 16:45 /tmp/userA-dir
(userB)> hadoop dfs -Dfs.trash.interval=0 -lsr /tmp
drwxr-xr-x   - userA users          0 2008-08-14 16:45 /tmp/userA-dir
drwxr-xr-x   - userA users          0 2008-08-14 16:45
/tmp/userA-dir/foo1
-rw-r--r--   1 userA users         13 2008-08-14 16:45
/tmp/userA-dir/foo1/a
-rw-r--r--   1 userA users         15 2008-08-14 16:45
/tmp/userA-dir/foo1/b
-rw-r--r--   1 userA users         25 2008-08-14 16:45
/tmp/userA-dir/foo1/c

(userB)> hadoop dfs -Dfs.trash.interval=0 -rmr /tmp/userA-dir
rmr: org.apache.hadoop.fs.permission.AccessControlException: Permission
denied: user=userB, access=ALL, inode="userA-dir":userA:users:rwxr-xr-x

(userB)> hadoop dfs -Dfs.trash.interval=1 -rmr /tmp/userA-dir
Moved to trash: hdfs://ucdev13.inktomisearch.com:47522/tmp/userA-dir
===========================================


-----Original Message-----
From: Brian Karlak [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 07, 2008 11:27 AM
To: [email protected]
Cc: Colin Evans
Subject: HDFS -rmr permissions

Hello --

As far as I can tell, "hadoop dfs -rmr" only checks the permissions of  
the directory to be deleted and it's parent.  Unlike Unix, however, it  
does not seem to check the permissions of the directories / files  
contained within the directory to be deleted.

Is this by design?  It seems dangerous.  For instance, we have a  
directory where we want to allow people to deposit common resources  
for a project.  Its permissions need to be 777, otherwise only one  
person can write to it.  But with 777 permissions, any fool can  
accidentally wipe it.

(Of course, if we have /trash set up, accidental writes are not as big  
a deal, but still ...)

Thoughts / comments?  Is there a way to make -rmr check the  
permissions of the files within the directories it's deleting, just as  
unix does?  If not, is this a legit feature request?  (I checked JIRA,  
but I didn't find anything on this ...)

Thanks,
Brian

Reply via email to