Cannot be authenticated with jenkins-cli


  • I am not able to be authenticated in Jenkins through jenkins-cli
  • I am getting Failed to authenticate with your SSH keys.


  • CloudBees Jenkins Enterprise
  • jenkins-cli


Failed to authenticate with your SSH keys.

suggests that the public key was not added into the user’s account (http://<JENKINS_URL>/user/<MY_USER>/configure), and/or did not pass the private key to the CLI command (using -i). Also, ensure that you are not specifying the username as this is not required for SSH.


1.419 and later
If your Jenkins requires authentication, you should set up public key authentication. Login from the web UI and go to, then set your public keys in the designated text area. When connecting to the server, the CLI will look for ~/.ssh/identity, ~/.ssh/id_dsa, ~/.ssh/id_rsa and use those to authenticate itself against the server. Alternatively, the -i option can be used to explicitly specify the location of the private key.

See the middle of this guide for how to generate SSH key pair, if you don't have one yet.

If you have used PuttyGen to generate your keys, you will have to convert them to OpenSSH format. Otherwise Jenkins might silently ignore your keys and you will be Authenticated as: anonymous.

To use the -i option the syntax is as follows:

java -jar jenkins-cli.jar [-s JENKINS_URL] [-i PRIVATE_KEY] command [options...] [arguments...]

Have more questions?


Please sign in to leave a comment.