Permission to mkdir and copyFromLocal



0
[root@localhost cloudera]# ls
datasets Documents eclipse Music Public Videos workspace
Desktop Downloads lib Pictures Templates wordcount
[root@localhost cloudera]# wordcount
bash: wordcount: command not found
[root@localhost cloudera]# cd wordcount
[root@localhost wordcount]# ls
input
[root@localhost wordcount]# cd input
[root@localhost input]# ls
words.txt
[root@localhost input]# hadoop fs -mkdir /worcount/input
mkdir: Permission denied: user=root, access=WRITE, inode="/":hdfs:supergroup:drwxr-xr-x
[root@localhost input]# sudo -u hdfs hadoop fs -mkdir /wordcount/input
[root@localhost input]# ls
words.txt
[root@localhost input]# hadoop fs -copyFromLocal words.txt /wordcount/input/words.txt
copyFromLocal: Permission denied: user=root, access=WRITE, inode="/wordcount/input":hdfs:supergroup:drwxr-xr-x
[root@localhost input]# sudo -u hdfs hadoop fs -copyFromLocal words.txt /wordcount/input/words.txt
copyFromLocal: `words.txt': No such file or directory
[root@localhost input]# hadoop fs -ls /wordcount/input/
[root@localhost input]# sudo -u hdfs hadoop fs -put words.txt /wordcount/input/words.txt
put: `words.txt': No such file or directory
[root@localhost input]# hadoop fs -mkdir /user/cloudera ; hadoop fs -chmod 777 /user/cloudera
mkdir: `/user/cloudera': File exists
chmod: changing permissions of '/user/cloudera': Permission denied

4 Answer(s)


0

cloudera manager, you can change the settings: hdfs->configuration->view&edit, uncheck the Check HDFS Permissions dfs.permissions and restart the hdfs.

0

issue solved

0

hi Edgar,

you are trying to execute commands as "root" user instead as" cloudera user. login as cloudera and try these commands

hadoop dfs -mkdir wordcount (this will be created in the path /user/cloudera/wordcount in hdfs)

Thanks

0

Issue Solved
[root@localhost wordcount]# hadoop jar dezyrewordcount.jar com.dezyre.DeZyreWordCount /wordcount/input/words.txt /wordcount/output
14/07/31 18:14:55 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.
14/07/31 18:14:56 INFO input.FileInputFormat: Total input paths to process : 1
14/07/31 18:14:59 INFO mapred.JobClient: Running job: job_201407311706_0001
14/07/31 18:15:00 INFO mapred.JobClient: map 0% reduce 0%
14/07/31 18:15:16 INFO mapred.JobClient: map 100% reduce 0%
14/07/31 18:15:25 INFO mapred.JobClient: map 100% reduce 100%
14/07/31 18:15:28 INFO mapred.JobClient: Job complete: job_201407311706_0001
14/07/31 18:15:28 INFO mapred.JobClient: Counters: 32
14/07/31 18:15:28 INFO mapred.JobClient: File System Counters
14/07/31 18:15:28 INFO mapred.JobClient: FILE: Number of bytes read=87
14/07/31 18:15:28 INFO mapred.JobClient: FILE: Number of bytes written=312529
14/07/31 18:15:28 INFO mapred.JobClient: FILE: Number of read operations=0
14/07/31 18:15:28 INFO mapred.JobClient: FILE: Number of large read operations=0
14/07/31 18:15:28 INFO mapred.JobClient: FILE: Number of write operations=0
14/07/31 18:15:28 INFO mapred.JobClient: HDFS: Number of bytes read=158
14/07/31 18:15:28 INFO mapred.JobClient: HDFS: Number of bytes written=46
14/07/31 18:15:28 INFO mapred.JobClient: HDFS: Number of read operations=2
14/07/31 18:15:28 INFO mapred.JobClient: HDFS: Number of large read operations=0
14/07/31 18:15:28 INFO mapred.JobClient: HDFS: Number of write operations=1
14/07/31 18:15:28 INFO mapred.JobClient: Job Counters
14/07/31 18:15:28 INFO mapred.JobClient: Launched map tasks=1
14/07/31 18:15:28 INFO mapred.JobClient: Launched reduce tasks=1
14/07/31 18:15:28 INFO mapred.JobClient: Data-local map tasks=1
14/07/31 18:15:28 INFO mapred.JobClient: Total time spent by all maps in occupied slots (ms)=16039
14/07/31 18:15:28 INFO mapred.JobClient: Total time spent by all reduces in occupied slots (ms)=6569
14/07/31 18:15:28 INFO mapred.JobClient: Total time spent by all maps waiting after reserving slots (ms)=0
14/07/31 18:15:28 INFO mapred.JobClient: Total time spent by all reduces waiting after reserving slots (ms)=0
14/07/31 18:15:28 INFO mapred.JobClient: Map-Reduce Framework
14/07/31 18:15:28 INFO mapred.JobClient: Map input records=5
14/07/31 18:15:28 INFO mapred.JobClient: Map output records=6
14/07/31 18:15:28 INFO mapred.JobClient: Map output bytes=58
14/07/31 18:15:28 INFO mapred.JobClient: Input split bytes=124
14/07/31 18:15:28 INFO mapred.JobClient: Combine input records=0
14/07/31 18:15:28 INFO mapred.JobClient: Combine output records=0
14/07/31 18:15:28 INFO mapred.JobClient: Reduce input groups=6
14/07/31 18:15:28 INFO mapred.JobClient: Reduce shuffle bytes=83
14/07/31 18:15:28 INFO mapred.JobClient: Reduce input records=6
14/07/31 18:15:28 INFO mapred.JobClient: Reduce output records=6
14/07/31 18:15:28 INFO mapred.JobClient: Spilled Records=12
14/07/31 18:15:28 INFO mapred.JobClient: CPU time spent (ms)=1610
14/07/31 18:15:28 INFO mapred.JobClient: Physical memory (bytes) snapshot=249974784
14/07/31 18:15:28 INFO mapred.JobClient: Virtual memory (bytes) snapshot=1336467456
14/07/31 18:15:28 INFO mapred.JobClient: Total committed heap usage (bytes)=171315200