back to index

SSH and SCP to/from an Android smartphone


Problem
Solution
TODO

Problem

There is a smartphone. It is rooted, as smartphones should be. There is need to connect to it from another machine and run processes and copy files to/from in a reasonably standard way.

There is a pretty good freeware Android app built around the Dropbear ssh server; rather rudimentary but does the job: DropBearServer II, "me.shkschneider.dropbearserver2". At this moment it does not seem to be in the Google Play Store anymore, said to be discontinued. The source is however here. The author is here.

The app's apk is still out there and has to be sideloaded. Here is one of the sources: http://m.downloadatoz.com/apps/me.shkschneider.dropbearserver2,90020.html (local copy: me.shkschneider.dropbearserver2.downloader.apk, of version 1.5.4.

The server provides decent ssh access, with support of keys. It however does not support scp out of the box, the binary is not in place:

scp on DropbearServerII on android:
error:
Welcome to DropBear SSH Server II!
sh: scp: command not found
lost connection

The search of the internet was mostly not fruitful, the scp binary was next to nowhere to be found.


Solution

A "kbox" package was found here: http://kevinboone.net/android_nonroot.html. The package itself is located at http://kevinboone.net/kbox.tar.gz. It is however rather large, with lots of source codes.

The needed files are some third-party binaries, included in the subdirectory ./kbox_term/contrib_image/bin/, which is mirrored here.

The scp and ssh binaries are needed. The ssh path in the scp binary is hardcoded, so it has to be specified from the commandline. For this reason, "scp" is a wrapper that runs "scp.bin" with the proper parameters:

#!/system/bin/sh
scp.bin -S /system/bin/ssh "$@"

The files are copied to the /system/bin directory, after unlocking it for write with "mount -o remount,rw /system" and then lock it again with "mount -o remount,ro /system".


TODO

The binaries available also have the "dropbear" binary, a sshd server. It can run the sshd server from a commandline or a shell script. This can be linked to events, like joining a certain wifi network.


If you have any comments or questions about the topic, please let me know here:
Your name:
Your email:
Spambait
Leave this empty!
Only spambots enter stuff here.
Feedback: