Today I’ve come across a weird an annoying problem “a undeletable file” in Windows that was created while using a shell script in Cygwin.

unkown_user and unknown_group unable to delete windows file

unkown_user and unknown_group unable to delete windows file

The file had owner:  “Unknown+User” and group:  “Unknown+Group” making virtually impossible to delete the file without restarting or booting the disk to avoid the file security context.

I tried using several utilities to restore the permissions or delete the file, including:

None of them worked, then finally I tried with another sysinternals tool handle which is included in Process Explorer, in recent versions of windows this is available in the process explorer, otherwise you’ll need to download and execute it.

In associated handles I searched part of the file name and found a process:

FInish the process which doesn't allow the file to be deleted.

FInish the process which doesn’t allow the file to be deleted.

Finally after killing that process the file got the correct user and group and I was able to delete it:

Fixed the file permissions after killing the process

Fixed the file permissions after killing the process