Support Questions
Find answers, ask questions, and share your expertise

HDFS chmod is not working

HDFS chmod is not working

Contributor

a)I want to change the permissions of file:-part-m-00001 to 777.The owner for this file is naresh.

The first two commands with sudo is showing command not found whereas hadoop fs -chmod 777 /vamsi/part-m-00003 command changes permissions to rw-rw-rw-but i want it to change to 777(rwxrwxrwx)

naresh@ubuntu:~/Work1/hadoop-1.2.1/bin$ sudo -u root hadoop fs -chmod 777 /vamsi/part-m-00001
sudo: hadoop: command not found
naresh@ubuntu:~/Work1/hadoop-1.2.1/bin$ sudo -u naresh hadoop fs -chmod 777 /vamsi/part-m-00001
sudo: hadoop: command not found
naresh@ubuntu:~/Work1/hadoop-1.2.1/bin$ hadoop fs -chmod 777 /vamsi/part-m-00003
Warning: $HADOOP_HOME is deprecated.
4 REPLIES 4
Highlighted

Re: HDFS chmod is not working

@vamsi valiveti

For recursive "chmod" you can also use the "-R" flag as following:

hadoop fs -chmod 777 -R /vamsi/part-m-00003

Looks like for the user "naresh" / "root" you might not have set the PATH properly to include the "~/Work1/hadoop-1.2.1/bin" directory. You should try setting that PATH value in the "~/.bashrc" of root as well as "naresh"

export PATH=/PATH/TO/Work1/hadoop-1.2.1/bin:$PATH
Highlighted

Re: HDFS chmod is not working

Contributor

part-m-00003 is file not directory.-R is to change all files in a directory.Please correct me if i am wrong?

hadoop fs -chmod 777 -R /vamsi/part-m-00003
Highlighted

Re: HDFS chmod is not working

Contributor

I tired below command but it is not changing to 777.It is changing to rw-rw-rw-

hadoop fs -chmod 777 -R /vamsi/part-m-00003
Highlighted

Re: HDFS chmod is not working

More example:

Setting Up Hadoop

You can set Hadoop environment variables by appending the following commands to ~/.bashrc file.

export HADOOP_HOME=/PATH/TO/hadoop-1.2.1
export HADOOP_MAPRED_HOME=$HADOOP_HOME 
export HADOOP_COMMON_HOME=$HADOOP_HOME 
export HADOOP_HDFS_HOME=$HADOOP_HOME 
export YARN_HOME=$HADOOP_HOME 
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/nativeexport PATH=$PATH:$HADOOP_HOME/sbin:$HADOOP_HOME/bin  
export HADOOP_INSTALL=$HADOOP_HOME 
Don't have an account?