Browse Source

HDFS-10455. Logging the username when deny the setOwner operation. Contributed by Rakesh R.

(cherry picked from commit 1c5708f6ded6ba9fc007eed93c1f65ba44451241)
Brahma Reddy Battula 8 years ago
parent
commit
c895f08936

+ 4 - 2
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java

@@ -83,10 +83,12 @@ public class FSDirAttrOp {
       fsd.checkOwner(pc, iip);
       if (!pc.isSuperUser()) {
         if (username != null && !pc.getUser().equals(username)) {
-          throw new AccessControlException("Non-super user cannot change owner");
+          throw new AccessControlException("User " + username
+              + " is not a super user (non-super user cannot change owner).");
         }
         if (group != null && !pc.isMemberOfGroup(group)) {
-          throw new AccessControlException("User does not belong to " + group);
+          throw new AccessControlException(
+              "User " + username + " does not belong to " + group);
         }
       }
       unprotectedSetOwner(fsd, iip, username, group);