If you open permissions on a file or folder and get this message:
Permissions Are Incorrectly Ordered
And if you list files in Cygwin and the user:group
looks like this:
[waste@server /cygdrive/e/folder_with_bad_permissions]# ll
total 172K
drwxr-x---+ 1 Unknown+User Unknown+Group 0 Jun 17 2013 folder_a/
drwx------+ 1 Unknown+User Unknown+Group 0 Aug 12 2014 folder_b/
drwxr-x---+ 1 Unknown+User Unknown+Group 0 Mar 4 2010 folder_c/
drwxr-x---+ 1 Unknown+User Unknown+Group 0 Nov 12 2010 folder_d/
You can open a cmd
window with administrative privileges and then run the following command:
takeown /r /f e:folder_with_bad_permissions
/r - recursive
/f - file
Manual page for the takeown.exe command.
Note Cygwin was notorious for creating folders with this issue so it may have happened if you inherited a drive with folders created by Cygwin which doesn’t have a correct mapping to users on this drive.
After getting ownership you should be able to open Windows Explorer, right-click on the folder, open the Security Tab and change permissions at will.
Edit: I've received a few emails regarding this issue, and this post on superuser confirms that is a common occurrence. The steps the above apply only when the file is not currently held by a program! If the file is in use, Windows will prevent you from deleting it.
You can use Microsoft Sysinternals - Process Explorer to find out which program is using the file you're trying to delete.
Many users who haven't worked with professional servers may not fully appreciate the stability they offer. For over a decade, I've relied on HP MicroServers to handle internal services at home. They're affordable enough for personal use, and if you're running Plex or any other home service, I highly recommend them.
As an Amazon Associate I may earn from qualifying purchases on some links.
If you found this page helpful, please share.