Skip to content

Commit c895f08

Browse files
HDFS-10455. Logging the username when deny the setOwner operation. Contributed by Rakesh R.
(cherry picked from commit 1c5708f)
1 parent 91640a0 commit c895f08

File tree

1 file changed

+4
-2
lines changed
  • hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ static HdfsFileStatus setOwner(
8383
fsd.checkOwner(pc, iip);
8484
if (!pc.isSuperUser()) {
8585
if (username != null && !pc.getUser().equals(username)) {
86-
throw new AccessControlException("Non-super user cannot change owner");
86+
throw new AccessControlException("User " + username
87+
+ " is not a super user (non-super user cannot change owner).");
8788
}
8889
if (group != null && !pc.isMemberOfGroup(group)) {
89-
throw new AccessControlException("User does not belong to " + group);
90+
throw new AccessControlException(
91+
"User " + username + " does not belong to " + group);
9092
}
9193
}
9294
unprotectedSetOwner(fsd, iip, username, group);

0 commit comments

Comments
 (0)