juicedata/juicefs · error · AccessControlException

Only SuperUser can do setOwner Action, the current user is "

Error message

Only SuperUser can do setOwner Action, the current user is " + username

What it means

Thrown by setOwner in the JuiceFileSystemImpl when the current user is not the super user (the superuser.isSuperUser style check fails) and permission checking is enabled. Ownership changes are restricted to the superuser, so the guard rejects any setOwner call from a regular user.

Source

Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:1951

    if (needCheckPermission() && !checkOwner(p, "setPermission")) {
      superGroupFileSystem.setPermission(p, permission);
      return;
    }
    statistics.incrementWriteOps(1);
    int r = lib.jfs_chmod(Thread.currentThread().getId(), handle, normalizePath(p), permission.toShort());
    if (r != 0)
      throw error(r, p);
  }

  @Override
  public void setOwner(Path p, String username, String groupname) throws IOException {
    if (needCheckPermission()) {
      if (username == null) {
        throw new AccessControlException(
            "User can not be null");
      }
      if (!superuser.equals(username)) {
        throw new AccessControlException(
            "Only SuperUser can do setOwner Action, the current user is " + username);
      }
      superGroupFileSystem.setOwner(p, username, groupname);
      return;
    }
    statistics.incrementWriteOps(1);
    int r = lib.jfs_setOwner(Thread.currentThread().getId(), handle, normalizePath(p), username, groupname);
    if (r != 0)
      throw error(r, p);
  }

  @Override
  public void setTimes(Path p, long mtime, long atime) throws IOException {
    if (needCheckPermission() && !checkPathAccess(p, FsAction.WRITE, "setTimes")) {
      superGroupFileSystem.setTimes(p, mtime, atime);
      return;
    }
    statistics.incrementWriteOps(1);

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Run the setOwner operation as the configured super user (typically the user who formatted the volume)
  2. Configure the client so permission checks are not enforced locally and ownership is managed elsewhere
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdk/java/src/main/java/io/juicefs/JuiceFileSystemImpl.java:1951 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/fff045655e7a99a1. Report an issue: GitHub.