I am trying to do a chmod 755 on all the directories and files in an HDFS directory but it wont persist all the way down.
for example, if I have a directory like this:
/home/set1/data1/file1.txt
I need to do this so my app can access it:
haddop fs -chmod 755 /home/set1/*
haddop fs -chmod 755 /home/set1/data1/*
haddop fs -chmod 755 /home/set1/data1/file*
haddop fs -chmod 755 /home/set1/data2/*
haddop fs -chmod 755 /home/set1/data2/file*
haddop fs -chmod 755 /home/set1/data3/*
haddop fs -chmod 755 /home/set1/data3/file*
how do I get the permission to set for each directory and file in the path in HDFS?
Changing HDFS File Permissions You must be a super user or the owner of a file or directory to change its permissions. With the chgrp, chmod and chown commands you can specify the –R option to make recursive changes through the directory structure you specify.
The file or directory has separate permissions for the user that is the owner, for other users that are members of the group, and for all other users. For files, the r permission is required to read the file, and the w permission is required to write or append to the file.
-chmod that stands for change mode command is used for changing the permission for the files in our HDFS. The first list down the directories available in our HDFS and have a look at the permission assigned to each of this directory. You can list the directory in your HDFS root with the below command.
Use "-R" (Recursive) option.
hadoop fs -chmod -R 755 /home/set1/data1/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With