[SOLVED] Cannot delete a file in documents folder

WrongRookie

Reputable
Oct 23, 2020
627
42
4,940
For some reason, after doing an update, I can't delete any file in the documents folder. I also can't save any file there either.

I've tried changing to admin, then disabled notify options, then went to advanced user accounts and I can't change the ownership after doing it once.

Even the security tab has all the options greyed out. Please help.
 
Solution
I've tried the two examples that should be icacls file /grant Administrator:(D,WDAC) and icacls file /grant *S-1-1-0:(D,WDAC) but it just says access is denied. What should I do? I don't know what the other examples will do.

are you able to start cmd.exe or powershell as an administrator? (elevated)
the net.exe commands can run as not elevated and give you your name and the administrators name just in case you have different logon names with different rights.

you can also use a user interface but I have been using this OS since before it had a UI and I tend to use the cmd line apps.

maybe something like
how to change folder and file permissions in windows 10 - Microsoft Community

bring up file explorer, right mouse...

WrongRookie

Reputable
Oct 23, 2020
627
42
4,940
What specific error message or pop-up window do you get when a deletion attempt fails?

What type of document are you trying to delete? Is the Documents folder shared with anyone else?

The error message I'm getting is that I need permission to delete the file and I should contact the user(which is me). And the files are anything from word files, game saves etc.

Even if I don't want to delete anything, I can't save anything to there either.
 
start a cmd.exe (admin if you can not required if you don't make changes to the info via this interface)
then type
net.exe user (this will show the names of the users for the machine)
whoami.exe (will show the name of the current user)
net .exe localgroup administrators (will show the names of the admins for the local machine)

if you changed ownership or reinstalled then the documents directory will belong to a different SID even if you used the same name.
fixing that requires a different command (i will see if i can quickly look it up. I always forget the it)

the command is icacls.exe
to see who has rights to your directory you would
start cmd.exe as an admin (if you want to make changes)
then run
icacls.exe c:\users\myaccountname\documents
and it will return something like this

C:\Users\Cloud\Documents>icacls c:\users\cloud\documents
c:\users\cloud\documents NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
BIGGLASSDOG\Cloud:(I)(OI)(CI)(F)

this shows on my machine that the built in administrators group has full access (F)
and the local account called Cloud on the machine BIGGLASSDOG has full access

whoami i shows that my login name is being mapped to the local account Cloud
even though I am logged in to a microsoft email account. I think the mapping was done when I did text verification from the microsoft account that I owned this machine.





you can run
icacls.exe /? to see all of the options and how to grant permissions to specific accounts/people or a particular SID
 
Last edited:

WrongRookie

Reputable
Oct 23, 2020
627
42
4,940
start a cmd.exe (admin if you can not required if you don't make changes to the info via this interface)
then type
net.exe user (this will show the names of the users for the machine)
whoami.exe (will show the name of the current user)
net .exe localgroup administrators (will show the names of the admins for the local machine)

if you changed ownership or reinstalled then the documents directory will belong to a different SID even if you used the same name.
fixing that requires a different command (i will see if i can quickly look it up. I always forget the it)

the command is icacls.exe
to see who has rights to your directory you would
start cmd.exe as an admin (if you want to make changes)
then run
icacls.exe c:\users\myaccountname\documents
and it will return something like this

C:\Users\Cloud\Documents>icacls c:\users\cloud\documents
c:\users\cloud\documents NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Administrators:(I)(OI)(CI)(F)
BIGGLASSDOG\Cloud:(I)(OI)(CI)(F)

this shows on my machine that the built in administrators group has full access (F)
and the local account called Cloud on the machine BIGGLASSDOG has full access

whoami i shows that my login name is being mapped to the local account Cloud
even though I am logged in to a microsoft email account. I think the mapping was done when I did text verification from the microsoft account that I owned this machine.





you can run
icacls.exe /? to see all of the options and how to grant permissions to specific accounts/people or a particular SID

I've tried the two examples that should be icacls file /grant Administrator:(D,WDAC) and icacls file /grant *S-1-1-0:(D,WDAC) but it just says access is denied. What should I do? I don't know what the other examples will do.
 
I've tried the two examples that should be icacls file /grant Administrator:(D,WDAC) and icacls file /grant *S-1-1-0:(D,WDAC) but it just says access is denied. What should I do? I don't know what the other examples will do.

are you able to start cmd.exe or powershell as an administrator? (elevated)
the net.exe commands can run as not elevated and give you your name and the administrators name just in case you have different logon names with different rights.

you can also use a user interface but I have been using this OS since before it had a UI and I tend to use the cmd line apps.

maybe something like
how to change folder and file permissions in windows 10 - Microsoft Community

bring up file explorer, right mouse click on the directory you want to check the rights to, select properties then secruity
you should be able to see who has rights to the directory . my documents folder has rights to
SYSTEM
my microsoft email account
and
administrators that are defined on my local machine. (shows as my machinename\administrators)

if i select a user then select the advance button i can change things like ownership

you can also use the take ownership tool( takeown.exe) but people tend to mess it up and take ownership from SYSTEM which is windows.
the end up reinstalling .

best to find out who has rights to the directory and logon with that account or any local admin account and then setting the rights correctly for your non admin
account.

here is a example of how to grant permissions to a directory with iacl
How to grant permission to users for a directory using command line in Windows? - Stack Overflow

C:\>icacls.exe "D:\test" /grant John:(OI)(CI)F /T
note that the directory name is in quotes "d:\test"
see the note about the /t option as being require or you will get an access denied error. the note is in the user comments
 
Last edited:
Solution

WrongRookie

Reputable
Oct 23, 2020
627
42
4,940
are you able to start cmd.exe or powershell as an administrator? (elevated)
the net.exe commands can run as not elevated and give you your name and the administrators name just in case you have different logon names with different rights.

you can also use a user interface but I have been using this OS since before it had a UI and I tend to use the cmd line apps.

maybe something like
how to change folder and file permissions in windows 10 - Microsoft Community

bring up file explorer, right mouse click on the directory you want to check the rights to, select properties then secruity
you should be able to see who has rights to the directory . my documents folder has rights to
SYSTEM
my microsoft email account
and
administrators that are defined on my local machine. (shows as my machinename\administrators)

if i select a user then select the advance button i can change things like ownership

you can also use the take ownership tool( takeown.exe) but people tend to mess it up and take ownership from SYSTEM which is windows.
the end up reinstalling .

best to find out who has rights to the directory and logon with that account or any local admin account and then setting the rights correctly for your non admin
account.

here is a example of how to grant permissions to a directory with iacl
How to grant permission to users for a directory using command line in Windows? - Stack Overflow

C:\>icacls.exe "D:\test" /grant John:(OI)(CI)F /T
note that the directory name is in quotes "d:\test"
see the note about the /t option as being require or you will get an access denied error. the note is in the user comments

Thanks but I ended up reinstalling and that somehow fixed the issues. :p
Oh well...guess reinstalling windows fixes off stupid problems that windows brings up.