Fixing “Access Denied” When Deleting NTFS Folder with No Owner and Missing Permissions


2 views

I recently encountered a particularly stubborn NTFS folder that resisted all attempts at deletion. Here's what made it special:

  • No visible owner (showed as "..." in dir /q output)
  • Missing security tab in Explorer
  • Resisted takeown.exe and icacls commands
  • Even SYSTEM account couldn't touch it

This typically happens when:

  1. The security descriptor becomes corrupted
  2. Inheritance breaks completely
  3. Ownership information gets lost during permission changes

After trying every conventional method, here's what finally worked for me:

# First get the folder's unique identifier
fsutil file queryfileid "C:\\path\\to\\folder"

# Then use the ID to delete it (Windows 8/Server 2012+)
fsutil file setzerodata offset=0 length=0 handle=FILE_ID

# Alternative for older systems using PowerShell
$folder = Get-Item "C:\\path\\to\\folder" -Force
[IO.File]::Delete($folder.FullName)

Before resorting to nuclear options, consider these:

# Using SubInACL (download from Microsoft)
subinacl /file "C:\\path\\to\\folder" /setowner=administrators
subinacl /file "C:\\path\\to\\folder" /grant=administrators=f

# PowerShell method (may work on some systems)
Take-Ownership -Path "C:\\path\\to\\folder"
Remove-Item -Path "C:\\path\\to\\folder" -Force -Recurse

Create a batch file with this content and schedule it to run at startup:

@echo off
:retry
del /f /q "C:\\path\\to\\folder\\*"
rmdir /s /q "C:\\path\\to\\folder"
if exist "C:\\path\\to\\folder" goto retry

To avoid this situation in the future:

  1. Always modify permissions through icacls rather than GUI
  2. Regularly check folder owners with dir /q
  3. Consider enabling Windows' built-in integrity checks

Recently while cleaning up an old Windows Server 2003 system, I encountered a particularly stubborn NTFS folder that resisted all deletion attempts. Even running commands as SYSTEM via PsExec yielded consistent "Access Denied" errors. The folder showed no owner (displayed as "...") in dir /q output and lacked security tabs in Explorer.

Standard remediation steps failed:

takeown /F "C:\problem_folder" /R /D Y
icacls "C:\problem_folder" /reset /T /C /L /Q

Both commands returned "Access Denied", suggesting deeper filesystem corruption. The folder existed in a sort of permission limbo - not owned by anyone, not accessible even to SYSTEM, and missing standard security descriptors.

After extensive testing, this multi-pronged approach succeeded:

# First, acquire SeBackupPrivilege
psexec -i -s cmd.exe

# Then attempt raw filesystem operations
subinacl /subdirectories "C:\problem_folder\*" /setowner=administrators
subinacl /subdirectories "C:\problem_folder\*" /grant=administrators=f /grant=system=f

# Force deletion using low-level API calls
del /f /q /a "C:\problem_folder"
rmdir /s /q "C:\problem_folder"

When all else fails, this PowerShell script using raw .NET methods can help:

$folder = "C:\problem_folder"
$acl = [System.Security.AccessControl.DirectorySecurity]::new()
$acl.SetAccessRuleProtection($false, $false)
[System.IO.Directory]::SetAccessControl($folder, $acl)
Remove-Item -Path $folder -Force -Recurse

To avoid similar issues:

  • Regularly audit filesystem permissions with icacls /save
  • Consider implementing resource guardian processes
  • Document ownership transitions during system migrations