Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is Jenkins still asking for an ssh passphrase after passing the key?

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?

like image 682
kraftydevil Avatar asked Oct 28 '15 20:10

kraftydevil


People also ask

How do I stop SSH from prompting key passphrase?

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.

Why do I have to enter passphrase for SSH 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.

How do you not enter passphrase for SSH key every time?

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.


1 Answers

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.

like image 52
sorin Avatar answered Nov 15 '22 04:11

sorin