icacls is giving access denied on remote file system

You do not have "Change permissions" rights as the user you are running icacls as. Either run the script/command prompt as administrator or make sure your user has change permission rights on the remote folder (and the files therein).

enter image description here


I Just saw your comment in your original question. FAT formatted drives do not have permissions settings. That is why the security tab is not there for you. On the server side when you are setting up folder sharing you should be able to set some basic permissions up (I don't know what OS the other machine is but I am assuming Win 7 for my example)

On the computer that is hosting the share, go to Properties->Sharing->Advanced Sharing->Permissions.

enter image description here

From there you need to make sure your user you are connecting as has Change permissions to be able to modify files.


Run Windows Command Prompt as administrator and then run:

takeown /R /F file1.txt

icacls file1.txt /t /c /GRANT Everyone:F

It works with folders as well.