hi lgnasi Barrera,

when i run

computeService.runScriptOnNode("node-id",
   new AuthorizeRSAPublicKeys(ImmutableSet.of("the public key")));

it gives error as "no credentials found for node"

hi Andrew philips

actually what i need is,  i got a ec2 instance that already have a ssh
keypair associated with it, but i dont get the private key  so that i need
to create a new key fair and add it to the instance

regards
Nipun



On Mon, Jun 23, 2014 at 3:05 AM, Ignasi Barrera <[email protected]> wrote:

> Ni Nipun,
>
> If I am not wrong, in AWS an instance can only be associated to one
> key pair, so I'd assume you're just trying to add a key to an existing
> user's "authorized_keys" file. You can do that by using the
> AuthorizeRSAPublicKeys statement [1]. You can do something like:
>
> // Add the public key to the default user of the instance
> computeService.runScriptOnNode("node-id",
>    new AuthorizeRSAPublicKeys(ImmutableSet.of("the public key")));
>
> // Add the public key to a specific ssh config directory
> computeService.runScriptOnNode("node-id",
>    new AuthorizeRSAPublicKeys("/home/foo/.ssh", ImmutableSet.of("the
> public key")));
>
>
> HTH!
>
> I.
>
> [1]
> https://github.com/jclouds/jclouds/blob/master/scriptbuilder/src/main/java/org/jclouds/scriptbuilder/statements/ssh/AuthorizeRSAPublicKeys.java
>
> On 22 June 2014 21:09, Andrew Phillips <[email protected]> wrote:
> > Hi Nipun
> >
> >
> >> I need to add a new ssh public key for a existing user in a ec2
> instance.
> >> I
> >> would be grateful if somebody can clarify how to do this with jclouds
> >
> >
> > Just to clarify: do you mean creating a new AWS EC2 key pair? Or do you
> mean
> > changing the private key for an OS user on a running instance of an EC2
> AMI?
> >
> > Regards
> >
> > ap
>



-- 
Nipun Udara

*Undergraduate*
*Department of Computer Science & Engineering*
*University of Moratuwa*
*Sri Lanka*

Reply via email to