I'm trying to start a Jenkins build from the command line on OS X.
Our server has authentication turned on so I have to authenticate from the command line call.
I've registered my ssh key with the jenkins server but I'm still required to enter the key's passphrase manually.
Here is the command I'm using:
$ java -jar jenkins-cli.jar -s http://localhost:8080/ -i ~/.ssh/id_rsa build 'MyApp'
After entering the command, I get this prompt:
Enter passphrase for /Users/jenkins/.ssh/id_rsa:
Why is the passphrase required when I'm using a private key and how do I overcome this?
Use ssh-add to add the keys to the list maintained by ssh-agent. After you add a private key password to ssh-agent, you do not need to enter it each time you connect to a remote host with your public key.
SSH passphrases protect your private key from being used by someone who doesn't know the passphrase. Without a passphrase, anyone who gains access to your computer has the potential to copy your private key.
ssh/id_rsa): [Hit enter] > Key has comment '/Users/you/. ssh/id_rsa' > Enter new passphrase (empty for no passphrase): [Type new passphrase] > Enter same passphrase again: [One more time for luck] > Your identification has been saved with the new passphrase. Save this answer. Show activity on this post.
This is happening because Jenkins is trying to use the ssh authentication method by default and is not smart enough to use your ssh agent, or to figure out that if you specify the user/password this does not makes sense.
If you want you can disable this behaviour by adding -noKeyAuth
parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With