I recently got a Samsung Captivate running Android. One of the things I’ve been working on recently is setting up remote access to it. To that end, I’ve worked on setting up a Dropbear ssh server on it.

You can download the binaries or the source and follow the instructions below to get it running on your phone.

Note: I take no credit for the source. I had a hard time finding all the working executables, so I built them with very minor modifications.

Download the tar file and extract it into /system/xbin

Make data directory and host keys

  • mkdir /data/dropbear
  • cd /data/dropbear
  • dropbearkey -t rsa -f /data/dropbear/dropbear_rsa_host_key
  • dropbearkey -t dss -f /data/dropbear/dropbear_dss_host_key

Generate keys for keyless auth and set permissions

  • mkdir /data/dropbear/.ssh
  • dropbear -t rsa -f id_rsa
  • dropbear -f id_rsa -y > /data/dropbear/.ssh/authorized_keys
  • chmod -R 600 /data/dropbear/.ssh

Since I want to use the key on my desktop, I need to convert it into a keyfile OpenSSH understands. I used dropbearconvert which was installed in /usr/lib/dropbear/dropbearconvert on my Debian machine under the dropbear package.

    • Move id_rsa off phone
    • dropbearconvert dropbear openssh id_rsa phone_rsa

Starting Dropbear on the phone.
I only want to allow logins using keys, so I start dropbear on the phone with the following command

    • dropbear -H /data/dropbear -s -p :22

I only want sshd running when I’m on my home wireless network, so I use a combination of Tasker and android-scripting to start and kill dropbear when I get home.