PC Review

Thread Tools Rate Thread

Robocopy error ERROR 5 Copying NTFS Security to Destination Directory

New Member
Join Date: Feb 2007
Posts: 1
      24th Feb 2007
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!
Reply With Quote
New Member
Join Date: Mar 2007
Posts: 1
      5th Mar 2007
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.

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

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 by Rathain; 5th Mar 2007 at 10:57 AM.. Reason: resolved my problem... might be applicable
Reply With Quote
New Member
Join Date: Oct 2010
Posts: 1
      16th Oct 2010

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..
Reply With Quote

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Robocopy sets attributes on destination folder to system and hidde =?Utf-8?B?TWl0Y2hX?= Windows Vista General Discussion 3 13th Aug 2008 10:27 PM
Rename destination file with Robocopy WB Windows XP General 3 28th Mar 2008 12:48 AM
Robocopy ignores NTFS security =?Utf-8?B?TmFkSg==?= Microsoft Windows 2000 0 22nd Aug 2005 05:02 PM
ROBOCOPY: How to use HTTP for file replication with Robocopy.exe Abhishek Sharma Microsoft Windows 2000 CMD Promt 11 10th Oct 2003 03:48 PM
ROBOCOPY: How to use HTTP for file replication with Robocopy.exe Abhishek Sharma Microsoft Windows 2000 File System 3 10th Oct 2003 03:48 PM




All times are GMT +1. The time now is 10:26 AM.