Search code examples
jenkinscloudbees

Why doesn't the Jenkins CLI work on our Dev@Cloud instance?


I've been unable to login to our Dev@Cloud instance using the Jenkins CLI WAR. Every time that I try, I get the following message:

You must authenticate to access this Jenkins.

My SSH keys are set in both our Jenkins instance and in GrandCentral. I've tried executing the login command, but I end up with the following exception:

org.acegisecurity.userdetails.UsernameNotFoundException: Not Found or Not Authorized
    at com.cloudbees.jenkins.plugins.dacsecurity.auth.CloudBeesUserDetailsService.loadUserByUsername(CloudBeesUserDetailsService.java:60)
    at com.cloudbees.jenkins.plugins.dacsecurity.auth.CloudBeesUserDetailsService.loadUserByUsername(CloudBeesUserDetailsService.java:12)
    at hudson.security.SecurityRealm.loadUserByUsername(SecurityRealm.java:305)
    at hudson.cli.ClientAuthenticationCache.set(ClientAuthenticationCache.java:94)
    at hudson.cli.LoginCommand.run(LoginCommand.java:37)
    at hudson.cli.CLICommand.main(CLICommand.java:229)
    at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:275)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:256)
    at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:215)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
    at hudson.remoting.InterceptingExecutorService$2.call(InterceptingExecutorService.java:95)
    at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Any help on this one is appreciated.


Solution

  • It may be a case where the right ssh key isn't being used when you connect - it will look in ~/.ssh/id_rsa etc - the same as the "ssh" command.

    If you still can't work it out - please do open a ticket [email protected] as you may need to talk more specifically about your setup

    You may need to put an entry in ~/.ssh/config like:

    Host account.ci.cloudbees.net                                                                                                                                                                          
      IdentityFile ~/.ssh/id_rsa 
    

    pointing to the private key you wish to use to identify (if you use the default one for your user you should be ok)