android - How to start SSH on a chroot Linux -


i managed initiate linux on android phone through terminal , start ssh service , tested using connectbot. however, manual operation. thinking more of automated way of doing this.

i used linux mechanism: http://mitchtech.net/android-backtrack-chroot/

my main issue believe i'm trying steps before , after chroot done, didn't seem work on android app:

runtime.getruntime().exec("su");  //mount image runtime.getruntime().exec("startbt");  //chroot linux runtime.getruntime().exec("bt");  //from inside chroot, start ssh service runtime.getruntime().exec("/etc/init.d/ssh start"); 

this did not seem work:

runtime.getruntime().exec("su & startbt & bt & /etc/init.d/ssh start"); 

i'm guessing again issue interpreted inside or outside chroot. main quest start ssh service automatically, not through android app.

if execute

runtime.getruntime().exec("su"); 

this launch su , exit. next exec won't executed elevated privileges. likewise after executing bt next command isn't executed within chroot environment.

i presume bt script? change pass arguments chroot, can pass command execute, like:

... chroot new_root /etc/init.d/ssh start ... 

to run this, need pass command su directly using -c option. , need pass commands string array (or use processbuilder):

runtime.getruntime().exec(new string[] {"su", "-c", "startbt; bt"}); 

another option make bt pass arguments command line chroot:

chroot new_root "$@" 

and pass them on command line:

runtime.getruntime().exec(new string[] {"su", "-c", "startbt; bt /etc/init.d/ssh start"}); 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -