Dummy's guide to Jenkins CLI with authentication

1,338 views
Skip to first unread message

Lewis, Eric

unread,
May 31, 2012, 9:24:44 AM5/31/12
to jenkins...@googlegroups.com
Hi

I'm trying to use the Jenkins CLI, but I'm getting nowhere...
We're using 1.460, and I did read https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI but the crucial part about how to generate an SSH key pair is missing.

My problem is that we have two different users:
- The Linux user under which Jenkins is running
- A build user which should have the right to run Jenkins CLI commands

We use Active Directory and thus the AD plugin to authenticate. The build user exists in AD, but the Linux user doesn't.
I tried to generate an SSH key pair using ssh-keygen, and it wrote the two key files into the ~/.ssh directory, but of course for the Linux user.
I then logged in with the build user and set the public key of the Linux user into the text area (that's the content of the file ~/.ssh/id_rsa.pub, right?)

But then I always get "Failed to authenticate with your SSH keys."

I'm probably doing something terribly wrong :-) but I have no clue.

Does anyone care to explain in simple steps what to do?

Thanks & best regards,
Eric

Mandeville, Rob

unread,
May 31, 2012, 9:53:16 AM5/31/12
to jenkins...@googlegroups.com
If you're not doing so already, try running the command line with "-i ~/.ssh/id_rsa". Your _private_ key should be passed in with the "-i" argument.

Also, double-check the "SSH Public Keys" field in your user config. For example, my public key listing looks like


ssh-dss AAAAB3NzaC1kc3MAAACBAJPyRLf7S/L859k4T8KHhipHBVd/ltB1LarT9bNjzir7KByz7AdU695JKESNUCq7J+pY8lDR+XDyJfqKoHeAyKUaO1CIC1A9Y8x/8O5KzNCcXv1o6jXvUavStU+0cnqBvUqDN6IuD8AmZvVes0hiTgC13GWqr4I1TGkMKYfF+w6rAAAAFQDMf2dxqCozcc+tphCnaZZEjr6TgQAAAIAX8cZOidtaom026qEzjd2PD8CjlaHc2XtwdistKKAFUZG/6APNa3JW1PeJIYqB0HTIgXPCItODzHSeiQ4l4J+ZjviV4lDIJkUTjJdYtpw3MU2Exj53xo5SH4Q41L/HYnsq2P+mEuM8CuooEQKcAUXLRCAqGQENRKU0duZDjC2ovgAAAIBOLI6heodoIFB+/yQNw8dpsUBbgFzz2cryU5/79wzTAu9v6SXxnfwnPapzPekp+eBehFeA8XdoGsm9xCvonWWkH7LrLVzfRQ5e3km4zTxw78dcN6tLoGIXOkuVIgfW2iT6j78FAfBLhOVfXsyVWQeMPoXUtoLFO1wZH+amOnnERQ== rmandevi@L-rmandevi-ws490


If there are any lines decorating it, it may well fail. Note that on my page, "ssh-dss" does not show up as its own line (as it may in the email depending on line breaking rules).

--Rob
The information in this message is for the intended recipient(s) only and may be the proprietary and/or confidential property of Litle & Co., LLC, and thus protected from disclosure. If you are not the intended recipient(s), or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication is prohibited. If you have received this communication in error, please notify Litle & Co. immediately by replying to this message and then promptly deleting it and your reply permanently from your computer.

Sami Tikka

unread,
May 31, 2012, 1:28:35 PM5/31/12
to jenkins...@googlegroups.com
Did you read https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+SSH ?

It should describe what you need to do.

-- Sami

Lewis, Eric

unread,
Jun 1, 2012, 11:44:36 AM6/1/12
to jenkins...@googlegroups.com
So the user with which I'm creating the keys is totally irrelevant?

Best regards,
Eric

-----Ursprüngliche Nachricht-----
Von: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] Im Auftrag von Mandeville, Rob
Gesendet: Donnerstag, 31. Mai 2012 15:53
An: jenkins...@googlegroups.com
Betreff: RE: Dummy's guide to Jenkins CLI with authentication

Mandeville, Rob

unread,
Jun 1, 2012, 11:46:54 AM6/1/12
to jenkins...@googlegroups.com
Correct. The Linux user is completely irrelevant. Jenkins ties a Jenkins account to a public key, and anyone using the matching private key to connect to Jenkins _is_ that Jenkins user, just like if they presented the proper username and password.

Lewis, Eric

unread,
Jun 1, 2012, 11:48:08 AM6/1/12
to jenkins...@googlegroups.com
Thanks for the hint: I read the page, but I'm none the wiser... sorry! It points to https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI and "working with credentials", which I already read and got stuck...

Best regards,
Eric

-----Ursprüngliche Nachricht-----
Von: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] Im Auftrag von Sami Tikka
Gesendet: Donnerstag, 31. Mai 2012 19:29
An: jenkins...@googlegroups.com
Betreff: Re: Dummy's guide to Jenkins CLI with authentication

Jay Blanton

unread,
Jun 1, 2012, 11:49:27 AM6/1/12
to jenkins...@googlegroups.com


From: "Lewis, Eric" <Eric....@ipi.ch>
To: "jenkins...@googlegroups.com" <jenkins...@googlegroups.com>
Sent: Friday, June 1, 2012 8:48 AM
Subject: AW: Dummy's guide to Jenkins CLI with authentication

Lewis, Eric

unread,
Jun 1, 2012, 12:33:42 PM6/1/12
to jenkins...@googlegroups.com
Thanks, it worked now, looks like the key got mangled in the UI...

Best regards,
Eric

-----Ursprüngliche Nachricht-----
Von: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] Im Auftrag von Mandeville, Rob
Gesendet: Freitag, 1. Juni 2012 17:47
Reply all
Reply to author
Forward
0 new messages