Thursday, 3 December 2009

SSH into my Android T-Mobile Pulse phone

Having installed the MoDaCo Custom ROM into my rooted phone, I then tried to ssh into it. The first thing I needed was the password - the instructions weren't clear, but I eventually found it in Settings/About Phone/Setup Wizard.

I used Putty to SSH into the phone (having got its IP address from my DHCP server logs) as root (using port 2222), and it worked. Now I wanted to use my public key, so I wouldn't be asked for the password again. Instructions were a bit fragmented, and I had a few false starts, but this is what I ended up doing:
  • cd /data/dropbear
  • mkdir .ssh
  • chmod 700 .ssh
  • cd .ssh
  • echo 'my public key' >authorized_keys
  • chmod 644 authorized_keys
  • cd ..
  • mount -o rw,remount -t yaffs2 /dev/block/mtdblock1 /system
  • edit /system/bin/dropbear.sh to add
    -R /data/dropbear/.ssh/authorized_keys
    to the end of the command line.
  • mount -o ro,remount -t yaffs2 /dev/block/mtdblock1 /system
  • reboot the phone (type "reboot" at the command line, or use the Quick Boot app on the phone).

The mount commands switch the filesystem from read-only (its usual state) to read-write and back again.


Brilliant - I now have password-free root access to my phone using ssh from my PC (which has a real keyboard). Some experimentation shows I have most of the commonly-used Linux commands available to me.

No comments: