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/xxx.xxx.dll’. Exception: Access to the path “/home/ec2-user/.octopus/Applications/OctopusServer/Integration/Daemon/0.0.0.59_3/xxx.xxx.dll” or “/usr/local/lib/xxxxx/xxx.xxx.dlll” 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?

Thanks

Hi,

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 (https://octopus.com/docs/deploying-applications/custom-scripts#Customscripts-ScriptsinPackagesscripts-in-packages or https://octopus.com/docs/deploying-applications/custom-scripts#Customscripts-Scriptsinpackagestepsscripts-configured-in-steps) 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: https://octopus.com/docs/deployment-targets/ssh-targets/sudo-commands

Regards,
Mark

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