I have a problem that when I do build to my job, its cannot put my file on the server directory in console output i get the message "ERROR: Exception when publishing, exception message [Permission denied]"

i have the following log output:

SSH: Connecting from host [rp_ci]
SSH: Connecting with configuration [web-dev] ...
SSH: Creating session: username [ubuntu], hostname [xx.xx.xx.xxx], port [22]
SSH: Connecting session ...
SSH: Connected
SSH: Opening SFTP channel ...
SSH: SFTP channel open
SSH: Connecting SFTP channel ...
SSH: Connected
SSH: Remote root is not absolute, getting absolute directory from PWD
SSH: cd [/home/ubuntu]
SSH: cd [deploy/]
SSH: put [dev-xx-xx.tgz]
SSH: Disconnecting configuration [web-dev] ...
ERROR: Exception when publishing, exception message [Permission denied]
Build step 'Send build artifacts over SSH' changed build result to UNSTABLE
Finished: UNSTABLE

For the target server Im using ubuntu server on AWS EC2 using nginx.

Someone know how to fix that's issue? I not found any clue for it around the web. Thanks!

  • What happens if you run the script manually as the Jenkins user? Any reason you're not using SCP instead of SFTP? – TheFiddlerWins Jan 15 '15 at 14:42
  • it is work in all my other servers, while Im using SCP I prompt an error:" Host key verification failed." – Cuzi Jan 15 '15 at 15:00

Permission denied when put dev-xx-xx.tgz. So check the file's permission setup: /home/Ubuntu/deploy/dev-xx-xx.tgz

  • You need to elaborate some more on what the problem is in order to turn this into a good answer. – kasperd Oct 22 '15 at 18:11

After looking at the plugin source code, it appears that it defaults to using a relative path if no "Remote Directory" is set in your ssh server configuration.

Go to Manage Jenkins/Confgiure System and under the plugin settings for publish over ssh, set Remote Directory to "/"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.