- You created an awesome script on Linux that builds your application that will automatically upload to another server via sftp or ssh.
- You want to go a step further and have Jenkins run the same script.
- Every time Jenkins runs the script it fails.
- You Curse Jenkins/Hudson and start pricing Atlassian tools instead.
One possible reasons could be because you have already accepted the RSA fingerprint.
The authenticity of host ‘18.104.22.168 (22.214.171.124)’ can’t be established.
RSA key fingerprint is 2c:78:0d:08:b7:06:ac:1a:be:5f:9a:4e:37:06:8f:53.
Are you sure you want to continue connecting (yes/no)?
You cannot get through to a remote sight for upload using Jenkins because even with Jenkins using your credentials, Jenkins still needs to accept the RSA Fingerprint to proceed.
You need to have sudo rights
There is a user switch in sudo that will allow you to ssh as jenkins.
$ sudo -u jenkins username@server
Manually accept the RSA fingerprint key.
Now test the script in Jenkins again. It should work unless there are other rights and directory paths that you need to work out.
Jenkins is a user with his own user directory. My Jenkin’s user directory was /var/lib/jenkins/
If you want to have Jenkins run a script, make sure it is in Jenkins directory.
Don’t name any of your Jenkin Items with spaces.
The Items you create are made into a directory inside Jenkin’s ~/workspaces/item-name
I am not a Linux expert, I am not certified in Linux. I have been using Linux systems for over 10 years now and love coming up with solutions using Open Source Software.