I am working on remote drive mounted on my system where i created some file i need to set some permission for that file.
I used icacls but its not working.
When i am trying to access file permission its working fine.
Z:\test_permission>icacls file1.txt
file1.txt "my user name":(I)(RX,W,DC)
Everyone:(I)(RX)While when i try to change its permission it says access denied.
Z:\test_permission>icacls file1.txt /deny "user name":R
file1.txt: Access is denied.
Successfully processed 0 files; Failed processing 1 files For work around: When on the same disk we are working from Linux and used chmod then all work fine.
Now i am trying to do same thing using Windows so i am using icacls.
Also i can't use Cygwin i have to use some Windows command only.
Please correct me if i am doing something wrong.
12 Answers
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).
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.
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:FIt works with folders as well.
1