How to do development in Android using SSHDroid

Android market has an application called SSHDroid.   If u can root your phone (higy recommended as u will learn more –> as there are a lot more u can do and control than without root)…..then running SSHDroid will open up a port at 22, and then u can ssh into the system…..First install SSHDroid….then run it (it needs WIFI…so u must have wifi setup…it does not use GSM, and it is quite safe….as only those who have connected to your WIFI can ssh into the phone)Then SSHDroid will tell u the root password (admin)…and ip address….then u ssh inside and and basically u can do anything like a linux env, eg chmod/ls/ps/dmesg.

First I created the ARM ELF binary:   myrintdata is the file created using agcc (

export LD_LIBRARY_PATH=/root/download/android/sync/ndk/build/platforms/android-8/arch-arm/usr/lib/:$LD_LIBRARY_PATH
export PATH=/sde3/root/download/android/sync/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin:$PATH
agcc myprint.c
mv a.out myprintdata

Next we will try to scp from inside the Android device to the host environment.   All the ssh/scp utilities is in the dropbear directory….but difficult/impossible to work:

# cd /data/data/
# ./scp root@ /sdcard
/system/bin/ssh: No such file or directory
lost connection

# ls /system/bin/ssh
/system/bin/ssh: No such file or directory
# echo $PATH

# ls /data/data/berse*/dropbear/ssh

# ls /data/data/berse*/dropbear/scp

So we know that ssh and scp all exists in the Dropbear directory – but since it is the $PATH directory, and the binaries not using the $PATH environment variable to look for the command (eg scp and ssh and sftp), this means that the binaries actually hardcode the other binaries in the standard path (/system/bin).   Another alternative to transfer file is needed.

# cp ssh /system/bin/
cp: not found

as noted….Android does not have “cp” command.

# dd if=scp of=/system/bin/scp
/system/bin/scp: cannot open for write: Read-only file system

Yes, dd can be used…but not in the /system directory.

Finally doing a scp from outside the Android environment (ie, host env):

Copy from outside into the Android devices (and it worked):

scp myprintdata  root@

Copy from inside the Android devices to outside (and it worked):

scp root@ .

After we copied the binary “myprintdata” to /sdcard or /data directory – executing it immediately worked!!!!

Why do I have to use SSHDroid to connect to the Android device?   Basically because this Samsung device I have is not able to communicate with my Linux laptop via USB at all – but another different Samsung phone is able to – most likely it is hardware problem, as both have been setup in the same way.

One response to this post.

  1. I user also Servers Ultimate which also has 40 other servers beside SSH.

    It can be found here:


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: