Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Permission denied when removing file from HDFS from sandbox

Solved Go to solution

Permission denied when removing file from HDFS from sandbox

New Contributor

Hi all,

Default Hortonworks Sandbox 2.3.2 running in VirtualBox on Mac El Capitan. I noticed when using the HDFS file manager GUI (at http://sandbox.hortonworks.com:8080/#/main/views/... ), any directories or files created are owned by "admin". Then, if I create directories or files by connecting to HDFS from the hadoop 2.7.1 command line client, they're owned by "matthew" (my Mac account name):

$ bin/hadoop fs -ls hdfs://sandbox.hortonworks.com:8020/tmp/bar15/12/18 10:25:33
WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Found 2 items
-rw-r--r--   3 matthew hdfs  116795988 2015-12-17 17:17 hdfs://sandbox.hortonworks.com:8020/tmp/bar/sh111.txt
-rw-r--r--   3 matthew hdfs   19465998 2015-12-17 17:13 hdfs://sandbox.hortonworks.com:8020/tmp/bar/sh19mb.txt

After creating those files, I can't delete them using the HDFS file manager GUI -- there is no delete (trash can) icon for the files owned by "matthew".

I then tried to delete them via hadoop 2.7.1 with command

bin/hadoop fs -rm -r -f hdfs://sandbox.hortonworks.com:8020/tmp/bar

and I get an exception that starts with

org.apache.hadoop.security.AccessControlException: Permission denied: user=matthew, access=WRITE, inode="/user/matthew/.Trash/Current/tmp":hdfs:hdfs:drwxr-xr-x

I tried to ls /user/matthew with command

bin/hadoop fs -ls hdfs://sandbox.hortonworks.com:8020/user/matthew

and got

ls: `hdfs://sandbox.hortonworks.com:8020/user/matthew': No such file or directory

How do I remove files created via the hadoop command line client in the Hortonworks Sandbox 2.3.2?

TIA,

Matthew

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Permission denied when removing file from HDFS from sandbox

@Matthew Adams

su - hdfs

hdfs dfs -chown -R matthew:hadoop /user/matthew

then try deleting it

6 REPLIES 6

Re: Permission denied when removing file from HDFS from sandbox

@Matthew Adams

su - hdfs

hdfs dfs -chown -R matthew:hadoop /user/matthew

then try deleting it

Re: Permission denied when removing file from HDFS from sandbox

New Contributor

My mac has no user "hdfs".

$ su - hdfs
Password:
su: Sorry

Am I supposed to ssh into the sandbox and execute these commands?

Further, there is no directory found called "/user/matthew" as I indicated in my original question, so if I'd be chown'ing something that doesn't exist.

I'm confused...

Re: Permission denied when removing file from HDFS from sandbox

Yes , please login into sandbox

http://127.0.0.1:4200 or you can do ssh from mac

HW11326:Downloads nsabharwal$ ssh root@127.0.0.1 -p 2222

root@127.0.0.1's password:

Last login: Thu Dec 17 23:34:06 2015 from 10.0.2.2

[root@sandbox ~]# su - hdfs

[hdfs@sandbox ~]$

Re: Permission denied when removing file from HDFS from sandbox

New Contributor

@Neeraj Sabharwal, that did the trick. Thanks!

Re: Permission denied when removing file from HDFS from sandbox

@Matthew Adams hdfs is life root user ;) superuser

If this thread is resolved then please accept one of the answers...Thanks for testing

Highlighted

Re: Permission denied when removing file from HDFS from sandbox

Contributor

hdfs dfs -mkdir /user/admin/matthew might be required.