Windows XP Robocopy error ERROR 5 Copying NTFS Security to Destination Directory

Joined
Feb 24, 2007
Messages
1
Reaction score
0
Hi, I have to carry out 2 data migrations this weekend and keep encoutering the error below when using robocopy:

ERROR 5 (0x00000005) Copying NTFS Security to Destination Directory i:\DATA\
Access is denied.

I added myself into the owner group for all area of data I am moving (Source and destination) earlier this week, and can copy files manually with right click copy\paste option so do not understand why I am getting this error. The users still have access to the source area but will not get access to the destination area till final copy is complete.

Running several jobs, all failing! Here are the two sets of option I am using for my two different jobs:

/mir /copy:dato /np /r:3 /w:5 /log+:datacopy_2402071500.log and
/e /copy:dato /np /r:3 /w:5 /log+:data2copy_2402071500.log

Our Server support moved to KL and this is not included in core business so up to us onsite support guys to help customers with data moves. I have been on maternity leave for two years, not long back and have lost all my notes and scripts I previously had cos they deleted my original account! So could be just doing something supid thats easily resolved - well thats what I hope anyway as need to get this data moved this weekend!

Thanks for any advice!
 
Joined
Mar 5, 2007
Messages
1
Reaction score
0
Your destination ACL may be getting deleted

Hi there,

Sorry for the late reply, I came across your post when researching a similar problem. My first suggestion would be to make sure that you are explicitly in the share and NTFS ACLs at both source and destination. Make sure you check this before and most especially AFTER you get this error.

In my case, I started out with full control on both the source and destination shares. The problem was that Robocopy was resetting the ACL on the destination share to a null value (nobody has permission) before it began recursing subdirectories. After some quick tests, my conclusion is that Robocopy does not handle inherited permissions. Say you are copying C:\Share1 to D:\, and C:\Share1 is inheriting its permissions from the C:\ root directory, it actually has no explicit ACL. Therefore, when you copy its ACL, you are actually copying... nothing. By copying an empty ACL to your destination your permissions are removed in the first step of the copy, and all subsequent writes to the share fail with Error 5.

This is only a problem when you are copying from a source which you are accessing WITH inherited permissions and a destination which you are accessing WITHOUT inherited permissions. If you copy C:\ (which has you explicitly in its ACL), to D:\, there is no issue. If this is indeed your problem, you can resolve it by adding yourself explicitly to the source ACL with full control. When the copy runs, your ACL entry is duplicated to the destination, and the subsequent file copies can be written. You can undo your changes (on both source and destination) after the copy completes.

If you continue to have problems despite the above, you might want to consider trying the /B switch, which attempts to back up the file using your privileges as a Backup Operator. This will allow you to copy files that you otherwise couldn't, for example, if you are not on the ACL on your destination share. Robocopy defaults to attempting a restartable copy. By giving up restartable copies the worst case is that you lose the file currently being transferred in the event of a disruption. The next pass will restart that file from its beginning instead of partway through.

Hope that helps. Here's a quote from Microsoft's Robocopy doc regarding the /B switch:

If you copy NTFS security information (ACLs) along with file data, it is possible to copy files to which you have read access, but not write access. After such a file is copied once, and the ACLs are applied, you may find that to get an “Access Denied” error when you try to copy the file again.
In this situation you should use the /B or /ZB switch to copy the files in Backup Mode.

/B copies all files with backup semantics (Backup Mode). /ZB first attempts to copy files in restartable mode (for greater resiliency) but if that fails with an “Access Denied” error it automatically retries the copy using Backup Mode.

Note
You must have the Backup Files and Restore Files privileges to copy files in Backup Mode using /B or /ZB.

Note
Backup mode copies are not restartable, but they enable you to copy some files as a Backup Operator that you would not be able to copy as a normal user.
 
Last edited:
Joined
Oct 16, 2010
Messages
1
Reaction score
0
Hi,

I'm facing the same issue too. Access denied with error 5, even with /zb parameters.
We have to go down to individual folders n sub folders to take over ownership, before robocopy can move files successfully.

Any easier way to do this? Because there's like ten over thousand subfolder within main folders, we'll take ages to assign this rights.

Thank you..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top