Deploying packages to SSH target - System.UnauthorizedAccessException

Have created a step to deploy packages on a Linux target. All is set up.
When I start the deployment, it fails when Calimari start the copy of the package content to the install directory.
I get the following error:

Retry #1 on copy ‘/usr/local/lib/xxxxx/’. Exception: Access to the path “/home/ec2-user/.octopus/Applications/OctopusServer/Integration/Daemon/” or “/usr/local/lib/xxxxx/” is denied.

I have checked manually on the target and the file exist in /home/ec2-user/.octopus/Applications/OctopusServer/…
Also I try to copy the file manually from one folder to the other and it failed with Permission denied.
So did the same with sudo and it worked.
The question is, how can we make Calamari/or the Octopus script (not the custom one) to use elevated privileges?



There’s no ability to run Calamari with elevated privileges. You have two options in your case.

  1. Give the SSH user Octopus is using permissions on your /usr/local/lib/xxxx folder.
  2. Don’t use our “Custom Installation Directory” option, instead add a PostDeploy script ( or that does a sudo copy to the destination folder. You can access the default deployment location in the Package.InstallationDirectoryPath variable. Note that you will need to set sudo not to prompt for a password for that user, which we describe here:


Thanks Mark.
I have used option 2 as it avoids changing the folder permission on the target.