Ram
Ram

Reputation: 731

how to change the file permissions in hadoop file system

I tried to change the file permissions. The file resides in HDFS, when I tried to set the permissions as 777 to the certain file, it is giving only read and write permissions whereas it is not giving the execution permission to the file.

This is what I tried:

root@ubuntu:/home/BATCH62# ll
total 56
drwxrwxrwx  2 root root  4096 2016-02-12 04:40 ./
drwxr-xr-x 16 root root  4096 2016-02-12 01:21 ../
-rwxrwxrwx  1 root root 40209 2016-03-10 19:22 processes.log*
-rwxrwxrwx  1 root root   111 2016-03-10 19:18 sample.log*
-rwxrwxrwx  1 root root   144 2016-02-12 04:32 test.log*
root@ubuntu:/home/BATCH62# mv test.log poc.log
root@ubuntu:/home/BATCH62# ll
total 56
drwxrwxrwx  2 root root  4096 2016-02-12 04:40 ./
drwxr-xr-x 16 root root  4096 2016-02-12 01:21 ../
-rwxrwxrwx  1 root root   144 2016-02-12 04:32 poc.log*
-rwxrwxrwx  1 root root 40209 2016-03-10 19:22 processes.log*
-rwxrwxrwx  1 root root   111 2016-03-10 19:18 sample.log*
root@ubuntu:/home/BATCH62# hadoop fs -put /hdfs61
Usage: java FsShell [-put <localsrc> ... <dst>]
root@ubuntu:/home/BATCH62# hadoop fs -put poc.log /hdfs61
root@ubuntu:/home/BATCH62# hadoop fs -ls /hdfs61
Found 5 items
-rw-rw-rw-   1 root supergroup        144 2016-02-12 04:35 /hdfs61/owner.log
-rw-r--r--   1 root supergroup        144 2016-02-12 04:41 /hdfs61/poc.log
-rw-rw-rw-   1 root supergroup        111 2016-02-12 01:29 /hdfs61/sample.log
-rw-rw-rw-   1 root supergroup        111 2016-02-12 00:51 /hdfs61/sample_.log
-rw-r--r--   1 root supergroup        144 2016-02-12 04:37 /hdfs61/users.log
root@ubuntu:/home/BATCH62# hadoop fs -chmod 777 /hdfs61/poc.log 
root@ubuntu:/home/BATCH62# hadoop fs -ls /hdfs61
Found 5 items
-rw-rw-rw-   1 root supergroup        144 2016-02-12 04:35 /hdfs61/owner.log
-rw-rw-rw-   1 root supergroup        144 2016-02-12 04:41 /hdfs61/poc.log
-rw-rw-rw-   1 root supergroup        111 2016-02-12 01:29 /hdfs61/sample.log
-rw-rw-rw-   1 root supergroup        111 2016-02-12 00:51 /hdfs61/sample_.log
-rw-r--r--   1 root supergroup        144 2016-02-12 04:37 /hdfs61/users.log
root@ubuntu:/home/BATCH62# 

Can anyone tell me what I did wrong ???

Thanks.

Upvotes: 2

Views: 7406

Answers (1)

BruceWayne
BruceWayne

Reputation: 3374

HDFS implements a permissions model for files and directories that has a lot in common with the Portable Operating System Interface (POSIX) model; for example, every file and directory is associated with an owner and a group. The HDFS permissions model supports read (r), write (w), and execute (x). Because there is no concept of file execution within HDFS, the x permission takes on a different meaning. Simply put, the x attribute indicates permission for accessing a child directory of a given parent directory.

https://issues.apache.org/jira/browse/HADOOP-3078

Upvotes: 3

Related Questions