Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Over the weekend I copied our company data from one hard drive to another larger one. I thought permission would have copied across but they haven't.

What is the best (and quickest) way to copy the permission that were originally set onto my new data, without having to copy all the data again? My users are now accessing the data so don't want to recopy the data as changes may be lost.

The data is hosted on windows server 2008 R2

share|improve this question
add comment

4 Answers

up vote 7 down vote accepted

I think that will do the work.

robocopy source destination /E /COPY:SOU /xo /xn /xc /xx /LOG+:F:\Sec.log.

SOU S=Security=NTFS ACLs, O=Owner info, U=aUditing info

If this do not work you can use this command to backup NTFS permissions:

icacls d:\data /save ntfspermissions.txt /t /c

The /T switch allows it to get subfolder permissions too. The /C switch allows it to continue even if errors are encountered (although errors will still be displayed).

And then use this command to restore them:

icacls d:\ /restore ntfsperms.txt

Note that in the command to save the permissions, I specified the target folder D:\Data, but when I restored them, I specified just D:\ as the target. You might think specifying D:\ as the target in the restore command may somehow mess up the permissions on other folders at that level, but as you can see from the ntfspermissions.txt output file, it only has information about the Data folder and subfolders, so that is all it will change.

share|improve this answer
1  
I think that icacls is the answer here. +1 –  MDMarra Jul 2 '12 at 13:00
    
agreed. since he can't recopy data as the data is already in use and likely changed, icacls to export/import the permissions seems to be the best way to go. –  Rex Jul 2 '12 at 14:22
    
Thanks for all your help, I am exporting icacls as I type and will try importing later. Next time I am going to remember to always check my permissions –  Funky Si Jul 2 '12 at 14:57
add comment

You can try using Robocopy. AFAIK it still works on newer Windows versions.

share|improve this answer
    
Do you know the syntax I need? I tried robocopy source destination /secfix /xo /xn /xc from the page above and it throws an error about not knowing which permissions to copy –  Funky Si Jul 2 '12 at 11:20
    
That's because robocopy will only work if the contents of the share is unchanged. It sounds like your users have probably changed it, right? I don't think that robocopy is the tool to use now (you should have used it in the beginning though) –  MDMarra Jul 2 '12 at 11:48
    
That guide is for a very early version of robocopy. What version are you using now? You may be able to get away with a /copy:s now to only change the NTFS ACLs, but I'm not sure... I'll kick off a little test now. –  HopelessN00b Jul 2 '12 at 11:57
add comment

Like Priaeas said, robocopy.

Handy reference guide for switches to use.

/copyall or /copy:DATSOU will copy "everything" (data, attributes, timestamps, NTFS ACLs, owner and auditing info).

/COPY:copyflag[s] : What to COPY (default is /COPY:DAT) (copyflags : D=Data, A=Attributes, T=Timestamps S=Security=NTFS ACLs, O=Owner info, U=aUditing info).

share|improve this answer
    
He specifically says that he doesn't want to copy the data. Also, robocopy will only copy security if the files haven't been modified. Since the share is in production now, I'd say it's a safe bet that it's changed. –  MDMarra Jul 2 '12 at 11:46
add comment

xcopy e:*.* z: /T /E /I /H /K /X /Y Believe it or not! e: was the root of a physical drive with several shares an all kinds of inheritance blocks dotted about. z: was the "new" one, in this case a mapped drive. It just worked, not for the shares, just the permissions.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.