How do I add permissions via command line for "everyone" on external HDD

15

8

I have an external HDD and I kind of messed up the file permissions but when fixing it I thought it is ok bc with my username I can access the files perfectly fine. Now that I use this with two PC (actually ATM I don't have access to my other PC) I can't access these files.

The problem is this directory has hundreds of folders with no permission for "everyone". I would like to give it the default permissions including have all access for the user "everyone". How do I do that via command line for these hundreds of folders?

user3109

Posted 2011-11-07T02:49:22.793

Reputation:

Try TAKEOWN /A to give ownership to the Administrator group, and then ICACLS to modify the permissions. – None – 2011-11-07T06:10:30.460

Answers

36

Use takeown to take ownership of the file

takeown /r /d y /f * 

^ Recursively takes ownership of all files without prompting "are you sure".

Follow it up with icacls set the access control list

icacls * /t  /grant Everyone:F

This will recursively grant Full access to user group "Everyone" to all files in the folder.

Sathyajith Bhat

Posted 2011-11-07T02:49:22.793

Reputation: 58 436

1Ownership takeover can also happen via icacls: Icacls * /setowner %USERNAME% /T /C /L. However not combined in a single command with step two (sadly). – Frank Nocke – 2015-06-15T10:41:21.317

1Thanks for this. I used a semicolon and specified a certain directory like this: takeown /f "e:\Users\myUserName" /r /d y; icacls "e:\Users\myUserName" /t /grant myUserName:f – Ryan – 2015-10-28T07:27:43.517

+1. Saved my day when copying back a ton of user's MP3 files originally taken from his home directory. Native Windows "Security" GUI was ultimately stupid -- it assigned "Everyone" to folders, but all files remained intact and thus inaccessible... We all love Windows "security" for that. :) – Alex Fortuna – 2015-11-09T10:56:34.667

Well, I managed to run the icalc command by mistake with my username replaced, in my Windows folder. Fingers crossed. @FrankN :) – Apache – 2017-01-01T23:13:04.417

0

This set owner of folder or file to group "Everyone" command works on windows 7 and above:

icacls "full path of file with file extension" /setowner "Everyone" /T /C

Stefanidis

Posted 2011-11-07T02:49:22.793

Reputation: 1