The Computer Oracle

How to bind old user's SID to new user to remain NTFS file ownership and permissions after freshly reinstall of Windows?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Luau

--

Chapters
00:00 How To Bind Old User'S Sid To New User To Remain Ntfs File Ownership And Permissions After Fresh
01:48 Answer 1 Score 3
02:59 Accepted Answer Score 15
03:16 Thank you

--

Full question
https://superuser.com/questions/439675/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#windows #permissions #ntfs

#avk47



ACCEPTED ANSWER

Score 15


You could use setacl to replace the orphaned SIDs with a new one. For example, use the following to replace your old SID with the new one:

setacl.exe -on C:\ 
           -ot file 
           -actn trustee -trst "n1:S-old-501;n2:S-new-501;ta:repltrst;w:d,s,o,g"
           -rec cont_obj



ANSWER 2

Score 3


  1. There is no supported way to change the computer's SID or to change the SID of a local account so that it does not match that of the computer.

  2. The wording of your question implies that you are reinstalling the operating system frequently, which you shouldn't need to do. If you are having repeated issues which require a reinstallation, it may be worth figuring out what is causing them rather than just reinstalling each time.

  3. Certain groups use well-known SIDs which means they do not change when the computer is reinstalled. So you may make your problem simpler by choosing permissions ahead of time so that they use these groups. Some of these groups that might be useful include Administrators, Power Users, Users, Authenticated Users and INTERACTIVE.

  4. One slow but easy way of resetting permissions for an entire folder tree is to copy it:

    robocopy /e /b c:\original-folder c:\new-copy
    

    This must be run from an elevated command prompt. Using the /b option makes robocopy use restore privilege to bypass security on the files. Create c:\new-copy before you start and set the permissions as desired.

    You can use this command to delete the original folder after you've copied it:

    robocopy /e /b c:\empty-folder c:\original-folder