Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-13626

Fix incorrect username when deny the setOwner operation

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.8.0, 2.7.4, 3.0.0-alpha2
    • Fix Version/s: 2.10.0, 3.2.0
    • Component/s: namenode
    • Labels:
      None
    • Environment:

      hadoop 2.8.2

      Description

      when do the chown operation on target file /tmp/test with user 'root' to user 'hive', the log displays 'User hive is not a super user' ;This appropriate log here should be 'User root is not a super user'

      [root@lhccmh1 ~]# hdfs dfs -ls /tmp/test
      rw-rr- 3 root hdfs 0 2018-05-28 10:33 /tmp/test
      [root@lhccmh1 ~]# hdfs dfs -chown hive /tmp/test
      chown: changing ownership of '/tmp/test': User hive is not a super user (non-super user cannot change owner).

      The last version patch of issue HDFS-10455 use username but not pc.getUser() in logs; 

       
             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);
               }
             } 

       

        Attachments

        1. HDFS-13626.01.patch
          3 kB
          Zsolt Venczel
        2. HDFS-13626-branch-2.001.patch
          1 kB
          Yiqun Lin

          Issue Links

            Activity

              People

              • Assignee:
                zvenczel Zsolt Venczel
                Reporter:
                Huachao luhuachao
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: