HOW TO: Native SSHd on Android
After many hours of yelling and screaming at my linux dev box, I finally got everything working so I can cross compile and port in theory any application to Android. Obviously the first step was to get SSHd working on the phone, specifically dropbear since it is much simpler than openssh.
Follow these exactly and you should have a running dropbear daemon.
If you have already rooted your phone and have busybox on your phone, I HIGHLY recommend walking through this to make sure you have done everything that is listed. There are a few things you must do for dropbear to work correctly
NOTE: I have not been able to login yet! I have been unable to find the password data for the phone. It is asking for a password when you login with root. And yes, I have tried no password and also common ones along with "android". All result in me still being locked out.
With that out of the way, lets begin. I am assuming you have a virgin G1. I will walk you through the entire procedure.
PART 1 - ROOTING YOUR PHONE
1. Download pTerminal from the marketplace or from http://android-dls.com/files/src.com...o.terminal.apk
. If you choose to download the file from the link provided, download it on the phone by going to this forum post and long holding the link.
2. Run pTerminal and type
3. Connect the phone to your wifi and go back to pTerminal and run:
This will show you the local ip of the G1.
4. Using your favorite telnet client, connect to your phone on the default telnet port 23.
PART 2 - BUSYBOX
5. Welcome to root access
We now need to get busybox on the phone. Again, pull up this thread on your phone and long hold the following link: http://staulkor.com/android/busybox.xxx
. Dont mind the .xxx extension. Browser wont let you download certain extension types. The xxx will be renamed to asc automatically.
6. We now need to remount /system because it is currently read only. After that we will copy busybox off the sdcard and put it in the bin directory and then make it executable. Go to your telnet app and type:
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/download/busybox.asc of=/system/bin/busybox
chmod 4755 /system/bin/busybox
busybox cp -s busybox cp
You now have access to the cp command. You can use that syntax to make a symlink to any of the busybox commands. MAKE SURE you do NOT overwrite the default symlinks. They have special syntaxes and you will most likely break things.
PART 3 - DROPBEAR
7. Now that you have busybox and the cp command (you MUST have the cp command), we need to create a directory.
This is where the encryption keys will be kept.
8. Now you have the required directory, you can download dropbear and dropbearkey.
Dropbear - http://www.staulkor.com/android/andr...-0.51.rev1.xxx
Dropbearkey - http://www.staulkor.com/android/andr...-0.51.rev1.xxx
Again, download them on the phone by long pressing each link and saving it.
I am using version 0.51 of dropbear. The rev1 is so you know what revision of the android port it is. Changes may have to be made and recompiled and I want to make sure you guys can tell the versions apart short of an md5 hash
9. Now that they are downloaded, they again change the .xxx extension to .asc automatically. We need to move them to /system/bin and make them executable.
cp /sdcard/download/android-dropbear-0.51.rev1.asc /system/bin/dropbear
cp /sdcard/download/android-dropbearkey-0.51.rev1.asc /system/bin/dropbearkey
chmod 4755 /system/bin/dropbear
chmod 4755 /system/bin/dropbearkey
10. Now we have to create the encryption keys. If you do not create them, dropbear will not run at all.
dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
11. Now dropbear is totally installed. You can run it by typing:
To check if it is running, type:
and to make sure it is listening, type:
and look for the 0.0.0.0:22 LISTENING
At any point if you have to kill dropbear, you will need to run ps, find the PID and then do "kill <pid>" without the brackets of course.
12. Now we can try to login to the phone. I run Vista on my main box, so I use putty for my ssh/telnet client. If you use linux/osx and type:
ssh root@<ip address of G1>
You should be able to connect to the phone and it will ask for a password.
13. ?????????? -- We need to be able to login. I cant find any password data on the phone. I am looking for that data to see if there is even a password, or if it would be possible to create a password, or a new user, or something.
Rooting the phone - http://android-dls.com/forum/index.p...rb_v=viewtopic
Busybox - http://android-dls.com/forum/index.p...rb_v=viewtopic
And big thanks to DarkriftX for making those tutorials and helping the cause