Undo setfacl changes

1

Using Cygwin in a virtual machine, I ran this command

setfacl --remove-all /cygdrive/c

After that I noticed this message:

C:\ is not accessible.
Access is denied.

I undid this change by restoring a snapshot. Then I ran this command

setfacl --remove-default /cygdrive/c

This did not deny access to the drive, but it did put a lock icon on any folders created after that.

remove default

Assuming that I had run these commands outside of a virtual machine, could these problems be fixed without reinstalling Windows?

Steven Penny

Posted 2015-04-10T05:30:34.117

Reputation: 7 294

Answers

1

I believe the following commands will fix it. After setfacl trashes the permissions, you need to temporarily take ownership of C:\, restore the permissions then set the owner back. Of course this is contingent on either having backed up the permissions beforehand, or perhaps transferring them from a clean virtual machine.

cd /cygdrive/c
icacls . /save acl.txt
setfacl --remove-all .
takeown /f .
icacls . /grant users:f
icacls acl.txt /grant users:f
icacls . /restore acl.txt
icacls . /setowner 'NT SERVICE\TrustedInstaller'

Steven Penny

Posted 2015-04-10T05:30:34.117

Reputation: 7 294

I mistakenly did this last night to try to fix umask issues. The solution you provided isn't working for me. I get "Error: Current working irectory has restricted permissions which render it inaccessible as Win32 working directory. Can't start native Windows application from here." when I try to run the command "icacls . /save acl.txt". Any ideas? – JoshuaD – 2015-12-24T21:32:53.423

I tried using my laptop to export the normal permissions for C:, but I get "permission denied, Successfully processed 0 files; Failed processing 0 files" when I try to run the second command in your list. – JoshuaD – 2015-12-24T21:38:34.440

in a windows command prompt, typing takeown /f C:\ allows you to use the windows permissions dialog to change the security settings. – JoshuaD – 2015-12-24T21:49:25.400