Change OWNER on NTFS


NTFS manage ACL and Ownership, I already explained how to change the permissions from a command line with CACLS on this post but I would like to explain how to change the ownership too.

You can use 2 tools: subinacl.exe and SetACL.exe

How can I use it ?

subinacl.exe /subdirectories "C:\MyFolder" /setowner="myUser"

SetACL.exe -on "C:\MyFolder" -ot file -rec cont_obj -actn setowner -ownr "n:S-1-5-21-1644491937-1993962763-725345543-2151;s:y"

SetACL require the User's SID, you can quickly find it using user2sid.exe
Share on Google Plus

About Vittorio Pavesi

    Blogger Comment
    Facebook Comment

4 commenti:

Gianni said...

Grazie per l'informazione :)

Anonymous said...

You don't have to use the SID. Example:

set USR=John
setacl -on "d:\home\%USR%" -ot file -rec cont_obj -actn setowner -ownr "n:%USR%;s:n"

Note the ;s:n. When you use s:y you are implying a SID. s:n means a user name, be a it local or domain user.

Vittorio Pavesi said...

Really thanks John !

Anonymous said...

Thank you.

I think the folder name needs a trailing slash: C:\cygwin\ instead of just C:\cygwin

"C:\Program Files\Windows Resource Kits\Tools\subinacl.exe" /subdirect
ories C:\cygwin\ /setowner="user"

Without it subinacl didn't seem to stick inside the specified folder but went searching my root directory tree for additional folders with the given name.