From ac35ee9393e0afce9fede1d2052e7bf4032312fd Mon Sep 17 00:00:00 2001 From: Brahma Reddy Battula Date: Thu, 27 Oct 2016 20:20:56 +0530 Subject: [PATCH] HDFS-10455. Logging the username when deny the setOwner operation. Contributed by Tianyin Xiu --- .../org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java index 417ce017ac..488c600bb1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirAttrOp.java @@ -84,10 +84,12 @@ static HdfsFileStatus setOwner( 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 " + pc.getUser() + + " 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 " + pc.getUser() + " does not belong to " + group); } } unprotectedSetOwner(fsd, iip, username, group);