Are you sure the user is the correct one? The "local user" we use in several examples is there when you use for example the "AdminAccess.standard()" script, which creates a user in the VM. Otherwise, you will probably have to use the default user in the image unless you explicitly create one when provisioning it.
jclouds should already be aware of those default users for the VMs you deploy using the compute service, so I'd try to change your code to just override the credentials (not the username) when running the script. Could you try if the following works for you? Map<? extends NodeMetadata, ExecResponse> responses = compute. runScriptOnNodesMatching(// inGroup(groupName), // predicate used to select nodes exec(command), // what you actually intend to run * overrideLoginPrivateKey(login) // ssh key* .runAsRoot(false) // don't attempt to run as root (sudo) .wrapInInitScript(false));// run command directly I. On 7 December 2016 at 13:47, Valentin Aitken < valentin.ait...@cloudsoftcorp.com> wrote: > Hi Poornima, > > Is it giving you an authentication error with no keyPair setting? > > Did you obtained computeService with proper identity and credential? > > Valentin. > > > > On 07/12/16 14:18, Poornima BS wrote: > >> Hi, >> >> I have started using jclouds from past few days. I have some doubts. >> >> After some googling i came to how we use an existing key pair as below, >> >> Template template = templateBuilder.build(); >> template.getOptions().as(AWSEC2TemplateOptions.class). >> subnetId("subnet-a1e1d08b"). >> keyPair("jclouds#jcloud").overrideLoginPrivateKey(login. >> credential); >> >> The above code uses the existing keypair. >> >> But when i try to run script on nodes, it fails giving error Authetication >> Exception, >> >> Map<? extends NodeMetadata, ExecResponse> responses = compute. >> runScriptOnNodesMatching(// >> inGroup(groupName), // predicate used to select nodes >> exec(command), // what you actually intend to run >> overrideLoginCredentials(login) // use my local user & >> // ssh key >> .runAsRoot(false) // don't attempt to run as root >> (sudo) >> .wrapInInitScript(false));// run command directly >> >> Please do the needful and let me know if i am doing correct. >> >> Thanks and Regards, >> Poornima.BS >> >> >