pentaho/pentaho-kettle · error · RepositoryObjectAccessException

Cannot delete another users home directory

Error message

Cannot delete another users home directory

What it means

deleteRepositoryDirectory also guards other users' home directories: when deleteHomeDirectories is false and the target is another user's home folder, a RepositoryObjectAccessException with type USER_HOME_DIR and message "Cannot delete another users home directory" is thrown.

Solutions

  1. Pass deleteHomeDirectories=true if deleting other users' home folders is intended (requires admin rights).
  2. Skip folders matching /home/<username> in the deletion loop.
  3. Catch RepositoryObjectAccessException and treat USER_HOME_DIR as a skip, not a fatal error.

Example fix

// before
repo.deleteRepositoryDirectory(dir, false);
// after
try { repo.deleteRepositoryDirectory(dir, true); } catch (RepositoryObjectAccessException e) { if (e.getAccessExceptionType() == AccessExceptionType.USER_HOME_DIR) skip(dir); else throw e; }
Defensive patterns

Strategy: try-catch

Validate before calling

boolean otherUsersHome = folder.getPath().startsWith("/home/") && !folder.getPath().equals("/home/" + user.getLogin()); if (otherUsersHome && !deleteHomeDirectories) skip(folder);

Try / catch

try { repo.deleteRepositoryDirectory(dir, deleteHomes); } catch (RepositoryObjectAccessException e) { if (e.getAccessExceptionType() == AccessExceptionType.USER_HOME_DIR) { log.info("skipped user home {}", dir.getPath()); } else throw e; }

Prevention

When it happens

Trigger: deleteRepositoryDirectory(dir, deleteHomeDirectories=false) where isUserHomeDirectory(folder) is true and folder is not the caller's own home — e.g. admin tooling deleting /home/otheruser.

Common situations: Bulk cleanup of stale user homes by admins; scripts assuming admin rights bypass the plugin-level guard.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/54f7838e96273db7. Report an issue: GitHub.

Appendix: source

Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java:576

    readWriteLock.writeLock().lock();
    try {
      // Fetch the folder to be deleted
      RepositoryFile folder;
      RepositoryFile homeFolder;

      folder = pur.getFileById( dir.getObjectId().getId() );
      // Fetch the user's home directory
      homeFolder = pur.getFile( ClientRepositoryPaths.getUserHomeFolderPath( user.getLogin() ) );

      // Make sure the user is not trying to delete their own home directory
      if ( isSameOrAncestorFolder( folder, homeFolder ) ) {
        // Then throw an exception that the user cannot delete their own home directory
        throw new KettleException( "You are not allowed to delete your home folder." );
      }

      if ( !deleteHomeDirectories && isUserHomeDirectory( folder ) ) {
        throw new RepositoryObjectAccessException( "Cannot delete another users home directory",
          RepositoryObjectAccessException.AccessExceptionType.USER_HOME_DIR );
      }

      pur.deleteFile( dir.getObjectId().getId(), null );
      rootRef.clearRef();
    } catch ( Exception e ) {
      throw new KettleException( "Unable to delete directory with path [" + getPath( null, dir, null ) + "]", e );
    } finally {
      readWriteLock.writeLock().unlock();
    }
  }

  @Override
  public ObjectId renameRepositoryDirectory( final ObjectId dirId, final RepositoryDirectoryInterface newParent,
                                             final String newName ) throws KettleException {
    return renameRepositoryDirectory( dirId, newParent, newName, false );
  }

View on GitHub (pinned to f3058517a1)