49308

Jenkins CLI Authentication

Question:

I am trying to run groovysh on my Jenkins from the cli, using the following command:

java -jar jenkins-cli.jar -s <Jenkins URL> -i JenkinsPrivateKey.ppk groovysh

I generated this private key file using PuttyGen, and pasted the public key into the SHH Public Keys box on the /me/configure page of the Jenkins. It's not that the key doesn't work - it seems like it's not authenticating at all. When I run who-am-i using the cli:

java -jar jenkins-cli.jar -s <Jenkins URL> -i JenkinsPrivateKey.ppk who-am-i

It gives me a response of:

Authenticated as: anonymous

What am I missing here? I thought if the authentication failed it would at least display an error message of some kind. Is there any way to verify that the private key actually works?

Edit: After some experimentation, it seems that authentication via the CLI does fail silently - I put a bogus public key in my profile configuration, and I still saw no error.

Answer1:

You may need to convert your putty keys to openssh format for them to work properly with the key.

See <a href="https://wiki.cloudbees.com/bin/view/DEV/Customer%2BProvided%2BSlaves%2BWindows" rel="nofollow">https://wiki.cloudbees.com/bin/view/DEV/Customer%2BProvided%2BSlaves%2BWindows</a>

"Back to Putty Key Generator, use Conversions > Export OpenSSH key to save the private key to a file."

If that works, feel free to edit <a href="https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI" rel="nofollow">the Jenkins CLI wiki page</a>!

Recommend

  • Option value are not getting assigned to an variable correctly
  • How to create a loop from 1-9 and from a-z?
  • input iterator skipping whitespace, any way to prevent this skipping
  • Why cant i transfer data to another HTML page
  • Call PHP document with SSH includes get variable
  • How to remove words from all text files in a folder?
  • Unable to get Google OAuth authentication working with React Native and Firebase
  • Best practices for storing sensitive information in source code
  • Is Firebase really Secure?
  • How to pass some more parameters to token endpoint web api 2
  • How do I retrieve the user information of a user authenticated with Apache's mod_ldap?
  • How do I configure context broker accept post requests from my remote sensor?
  • Ajax calls do not work in IE unless you fiddle with security settings
  • Keep this build forever option - Jenkins
  • MVC3 Razor - ListBox pre-select not working
  • Set the selected item in dropdownlist in MVC3
  • ilmerge with a PFX file
  • Spring Data JPA custom method causing PropertyReferenceException
  • Can I display google adwords (AdView) in javafx on android
  • swift auto completion not working in Xcode6-Beta
  • Validaiting emails with Net.Mail MailAddress
  • sending/ receiving email in Java
  • htaccess rewriting URLs with multiple forward slashes
  • Javascript + PHP Encryption with pidCrypt
  • How to show dropdown in excel using jrxml (jasper api)?
  • Display Images one by one with next and previous functionality
  • Web-crawler for facebook in python
  • R: gsub and capture
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Cannot Parse HTML Data Using Android / JSOUP
  • Comma separated Values
  • A cron job substitute?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • JTable with a ScrollPane misbehaving
  • unknown Exception android
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • failed to connect to specific WiFi in android programmatically
  • How can I use threading to 'tick' a timer to be accessed by other threads?
  • How to load view controller without button in storyboard?