Robocopy permission issue

access-control-listntfsrobocopy

I'm using robocopy to sync files between two different servers (one of them is not a Windows server but exposes Windows-like shares); but I'm having a permission issue.

I need to replicate all contents and also keep existing ACLs; I'm using a command like this:

robocopy.exe \\server1\share \\server2\share /mir /copyall

However, the user account which runs this command has only read access to some folders; this leads to an interesting problem: after the first sync, the same permissions are applied to the copied folders… and thus the user account loses write access to those folders and can't update them anymore.

Is there any way to avoid or fix this?

Best Answer

Robocopy includes an option /b that activates and uses the special Backup privileges that allow the process to bypass access controls. Assuming default rights assignments, you need to be running as an administrator, server operator, or backup operator to use this option. The /zb option tells robocopy to only use the backup mode when needed.