Reputation: 1275
I have VSTS Agent running as a service under the 'Network Service' account.
When I attempt to use "Copy Files Task" the task sometimes generates an error "Failed cp: cp: copyFileSync: could not write to dest file (code=EPERM)..."
Example Error: 2018-09-25T15:26:00.2055152Z ##[error]Error: Failed cp: cp: copyFileSync: could not write to dest file (code=EPERM):F:\Legacy\WinTools.Web\Web.config
Other posts on StackOverflow mentioned an open file or insufficient rights to perform action.
The issue turned out to be the account 'NETWORK SERVICE' did not have the appropriate modify rights to the target folder. By adding modify rights for the mentioned account the release pipeline was able to successfully copy over the desired files.
I am adding this for posterity in the hopes that someone else out there avoids the same issue I encountered.
Upvotes: 6
Views: 6436
Reputation: 2793
My "Network Service" had god rights on the web site deployment folder and the account under which the agent was running also had god rights as it was a member of the administrators group.
I explicitly added the user to the folder and gave it full control and now there doesn't appear to be any permissions issue.
Upvotes: 0
Reputation: 1275
Dan Friedman,Jayendran
Question: Why does Copy Files Task in VSTS sometimes produce an error "Failed cp: cp: copyFileSync: could not write to dest file (code=EPERM)"
Possible Answers: 1. File is potentially locked 2. User does not have sufficient rights to perform action
My Answer: In my case the issue was the service account under which VSTS Agent was running 'Network Service' did not have appropriate rights to modify files in the specified folder. By enabling modify rights I was able to avoid the exception noted.
Upvotes: 6