tags:

views:

48

answers:

3

Hello everyone.

First, I'm new to Java and Android Development so I hope you're patient with me :)

My aim in my first app is to establish an ssh-connection to my linux machine running openssh and sending commands to it on the one hand and receiving stdout on the other hand.

Since there is an app for doing all the ssh that absolutely benefit to my needs, (connectbot) I thought it would be the best not reinventing the wheel and using connectbot for sending commands.

As I read there is a general mechanism in android to do so called intents. And I found that connectbot seems to offer such intents, but I don't feel able to use them at the moment and I'm not quite sure if it it works that way in general: http://www.openintents.org/en/node/102

As I said I'm new to java and android and only did a few hello world examples using these great xtensivearts video tutorials: So its a bit hard for me to get started the right way.

What do I want to do exacly?

Simply onpressbutton in my app -> sending a certain command in the background to the ssh-connected machine via connectbot or anything that can provide that.

In further development I would like to get data from the ssh-connected machine (stdout would be enough due to I could handle the output server-sided)

All this has to take place in the activity of my app. Even username and password should be configured via the settings of my app.

It simply should use the basic features of ssh via connectbot.

I would be really happy if you could help me getting started right with this issue. I know it sounds a bit hard for the first app but I really need ssh in my app cause it would greatly facilitate the server sided development.

Thanks and Regards

A: 

I believe connectbot is open source. There's probably some documentation on it.

It may even implement an SSH tunneling feature such that you could just write a fairly ordinary network socket app that would talk through the encrypted tunnel to your linux box. Or it may not.

Another option would be to "drive" a modified connectbot from your application, either using binder/aidl type mechanisms if it's java-to-jave, or using unix mechanisms such as pipes or unix domain sockets.

Assuming this isn't just a personal use project you'll also need to think a bit about how distribution will work, especially if you have to make a modified connectbot.

I wouldn't be surprised if there's an ssh library in java available somewhere either.

Another option would be to run a web server on your linux box and just access it via https - no android development needed at all, just put buttons on a web page. Though if you have a homebrew ssl certificate getting the phone to recognize that might take some research.

Chris Stratton
A: 

Hello Chris,

Thanks for your answer :-)

I believe connectbot is open source. There's probably some documentation on it.

ConnectBot is opensource you're right and I plan to make my development opensource too.

Assuming this isn't just a personal use project you'll also need to think a bit about how distribution will work, especially if you have to make a modified connectbot.

I guess I should be more detailed what I exacly plan to do:

The android app I plan to develop is an remote-control-app to control rhythmbox and vlc player via command line. Also I want to receive information about the available music on the linux machine so that the user can choose a track to be played. This whole thing is a private project which I do together with my audiophile cousin. We recognized that rhythmbox delivers the absolute best sound if you compare it with other media centers or windows sound or even the best cd-players available. This is all is testet with a modified auzentech soundcard on an absolute highend audio system (that type where you can decide buying a house or that audio setup ;-) ).

Another option would be to run a web server on your linux box and just access it via https - no android development needed at all, just put buttons on a web page. Though if you have a homebrew ssl certificate getting the phone to recognize that might take some research.

Rhythmbox and VLC (Which shall deliver PartySound instead of audiophile sound) are complete controllable via console so I can spare a lot of coding by simply sending ssh commands to the machine.

Even the privacy problem would be solved due to the encryption of ssh. I just don't want neighbours to have a look on the music collection because its accessable via http. It could go that far that I would be able to bundle the remote control via a key. If I used http(s) I have to care about htaccess and many things that wouldn't be nessassary if i could use ssh.

It may even implement an SSH tunneling feature such that you could just write a fairly ordinary network socket app that would talk through the encrypted tunnel to your linux box. Or it may not.

There is a class called SSH but using this class implementing this in my app doesnt seem to be as easy as simply using Intents, if the app offers, what I need where I'm still not sure if it does.

Another option would be to "drive" a modified connectbot from your application, either using binder/aidl type mechanisms if it's java-to-jave, or using unix mechanisms such as pipes or unix domain sockets.

Do you mean just to change the layout of connectbot client and sending hard coded ssh instead? Sounds not bad due to I plan to do an opensourceapp as well. Which Problem could occur here? At least I will give this a try ;-)

I wouldn't be surprised if there's an ssh library in java available somewhere either. Yes there is but I guess thats a bit hard for me at the moment as a newbie in Java AND Android

Has anyone further suggestions tipps or solutions for this issue?

Regards

André Herrmann