GuoPhilipse commented on PR #4602:
URL: https://github.com/apache/hadoop/pull/4602#issuecomment-1322966990

   > Did you test it? This behavior is consistent with the local file system.
   
   Thanks for your review @tomscut , actually `chown ` command can be used for 
change owner or group belong info.
   i used chown to change the file group ,keeping the owner as the before.
   maybe we can make it clearer ,if we use `chown` to change owner ,super user 
is a must, if we use `chown` to change the group ,then user either may be the 
owner of the files or the super user.
   
   reproduce steps as the following
   step1 :create new group
   `groupadd philipse1`
   
   step2:add user to the group
   `useradd philipse -g philipse1`
   
   step3: touch a file(any user)
   hdfs dfs -touch /tmp/test2/test3
   
   step4:use super user(hadoop is the super user) to change the owner and group 
of the file to philipse 
   hdfs dfs -chown philipse:philipse /tmp/test2/test3
   now we get the file info as the following:
   `-rw-r--r--   3 philipse philipse          0 2022-11-22 10:53 
/tmp/test2/test3`
   step5:use owner philipse to change new owner, there will be error,for 
philipse is not the super user
   `
   hdfs dfs -chown root:philipse /tmp/test2/test3
   chown: changing ownership of '/tmp/test2/test3': User philipse is not a 
super user (non-super user cannot change owner).`
   
   step6:use owner philipse to change new group, the command will be ok.
   `hdfs dfs -chown philipse:philipse1 /tmp/test2/test3`
   
   let's see the result,the group has been modifyed by `chown` command.
   
   `
   hdfs dfs -ls /tmp/test2/test3
   -rw-r--r--   3 philipse philipse1          0 2022-11-22 10:53 
/tmp/test2/test3
   `
   
   
   
   
    


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to