0

I am looking to ssh into an Ubuntu Server via some (java) API. Is that even possible?

Here is what I am looking for exactly:

  • I have setup OpenStack on an ubuntu machine.
  • Launched an instance with ubuntu server.
  • Installed android SDK on this Virtual Machine.
  • By ssh-ing into this Virtual Machine, I am able to create an AVD and run an emulator (headless).

What I plan to do is provide some web client to start the emulator at the click of a button (considering everything is already set up i.e the Virtual Machine is up and running with the SDK installed).

I guess I need to execute the command to start the emulator. But is it possible to do this via some (java) API? I had a look into openstack4j and JClouds but could not find much. I tried to figure out it is using some ssh client library. Is that right?

Anything I am missing here?

3
  • I think you are confusing some things. An instantiated Virtual Machine over an open stack, is just a server (an Ubuntu server in your). Since that machine has access to the network, connecting to it has nothing to do with open stack, nova, jclouds or anything else. It just an ubuntu server, nothing more nothing less. So please redefine your question and I will be glad to help. Commented Apr 26, 2015 at 16:18
  • Okay I edited the question. Sorry I am new to cloud, openstack, ssh everything. I have to ssh into my ubuntu server using some java lib. I found that JClouds also has a sshjsshclient class. That is what I might need right? Commented Apr 26, 2015 at 16:59
  • 1
    You still overloading us with information the we do not, I assume this is because you do not know the right terminology. I updated your question to make it more clear. I am saying again that openstack and nova does no have anything to do with you problem. Commented Apr 26, 2015 at 17:09

1 Answer 1

1

Have a look at this CloudServersPublish.java example, in particular the configureAndStartWebserver() method.

Also note how the SshjSshClientModule is added to the ComputeServiceContext in the constructor.

You'll also need to make sure you have the jclouds-sshj dependency.

<dependency>
  <groupId>org.apache.jclouds.driver</groupId>
  <artifactId>jclouds-sshj</artifactId>
  <version>1.9.0</version>
</dependency>
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, that was helpful! Following the link you shared and looking at the example here github.com/jclouds/jclouds-examples/tree/master/compute-basics , I was able to make it work. Marked your answer as accepted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.