{"record":{"id":"34b5374d750d1575","repo":"pentaho/pentaho-kettle","slug":"you-are-not-allowed-to-delete-your-home-folder","errorCode":null,"errorMessage":"You are not allowed to delete your home folder.","messagePattern":"You are not allowed to delete your home folder\\.","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java","lineNumber":572,"sourceCode":"\n  @Override\n  public void deleteRepositoryDirectory( final RepositoryDirectoryInterface dir, final boolean deleteHomeDirectories )\n    throws KettleException {\n\n    readWriteLock.writeLock().lock();\n    try {\n      // Fetch the folder to be deleted\n      RepositoryFile folder;\n      RepositoryFile homeFolder;\n\n      folder = pur.getFileById( dir.getObjectId().getId() );\n      // Fetch the user's home directory\n      homeFolder = pur.getFile( ClientRepositoryPaths.getUserHomeFolderPath( user.getLogin() ) );\n\n      // Make sure the user is not trying to delete their own home directory\n      if ( isSameOrAncestorFolder( folder, homeFolder ) ) {\n        // Then throw an exception that the user cannot delete their own home directory\n        throw new KettleException( \"You are not allowed to delete your home folder.\" );\n      }\n\n      if ( !deleteHomeDirectories && isUserHomeDirectory( folder ) ) {\n        throw new RepositoryObjectAccessException( \"Cannot delete another users home directory\",\n          RepositoryObjectAccessException.AccessExceptionType.USER_HOME_DIR );\n      }\n\n      pur.deleteFile( dir.getObjectId().getId(), null );\n      rootRef.clearRef();\n    } catch ( Exception e ) {\n      throw new KettleException( \"Unable to delete directory with path [\" + getPath( null, dir, null ) + \"]\", e );\n    } finally {\n      readWriteLock.writeLock().unlock();\n    }\n  }\n\n  @Override\n  public ObjectId renameRepositoryDirectory( final ObjectId dirId, final RepositoryDirectoryInterface newParent,","sourceCodeStart":554,"sourceCodeEnd":590,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepository.java#L554-L590","documentation":"deleteRepositoryDirectory protects the current user's home folder: if the folder to delete is the same as, or an ancestor of, the user's own home folder, a KettleException \"You are not allowed to delete your home folder.\" is thrown before any deletion occurs.","triggerScenarios":"Calling deleteRepositoryDirectory(dir, ...) where dir resolves to /home/<your-username> itself or any parent of it (e.g. attempting to delete /home while logged in as that user).","commonSituations":"Cleanup scripts that recursively delete from /home and reach the operator's own home folder; users with admin rights accidentally deleting their own home via scripts.","solutions":["Exclude the current user's home folder (and its ancestors) from the deletion set.","Compare folder.getPath() against ClientRepositoryPaths.getUserHomeFolderPath(user.getLogin()) before deleting.","Delete only leaf content inside the home folder, not the folder itself."],"exampleFix":"// before\nrepo.deleteRepositoryDirectory(dir, true);\n// after\nif (!folder.getPath().startsWith(\"/home/\" + user.getLogin())) { repo.deleteRepositoryDirectory(dir, true); }","handlingStrategy":"validation","validationCode":"String home = \"/home/\" + user.getLogin(); if (folder.getPath().equals(home) || home.startsWith(folder.getPath())) throw new IllegalArgumentException(\"refusing to delete own home folder\");","typeGuard":null,"tryCatchPattern":"try { repo.deleteRepositoryDirectory(dir, true); } catch (KettleException e) { if (e.getMessage().contains(\"home folder\")) skipHome(folder); else throw e; }","preventionTips":["Filter out the current user's home and its ancestors from deletion batches","Compare full paths, not just names","Prefer deleting content inside the home folder, not the folder"],"tags":["pentaho","repository","permission"],"backgroundTag":"permission-denied","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}