Sony Updates AOSP Sources to Android 5.0.1

Just a few days ago, Sony did an utterly fantastic job by pushing out numerous device trees for … more

Stop Your Screen From Turning Off with KeepItOn

We all know the feeling of reading a news article orrather longdocument, when our screen … more

The XDA LG QPair Developer Challenge Voting Has Begun!

It seems like it was just yesterday that weannounced that we had paired up with LGto … more

Major Update for the Sony Smartwatch 2 Brings DND and More

With the wearables landscape now dominated by Android Wear and Pebble, its … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

HOW TO: Native SSHd on Android

OP staulkor

5th November 2008, 10:20 PM   |  #1  
OP Senior Member
Flag Phoenix, AZ, USA
Thanks Meter: 29
 
259 posts
Join Date:Joined: Jan 2007
More
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

Code:
cd /system/bin
and then

Code:
telnetd
3. Connect the phone to your wifi and go back to pTerminal and run:

Code:
netstat
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:

Code:
mount -o remount,rw /dev/block/mtdblock3 /system
dd if=/sdcard/download/busybox.asc of=/system/bin/busybox
chmod 4755 /system/bin/busybox
cd /system/bin
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.

Code:
mkdir /system/etc/dropbear
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.

Code:
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.

Code:
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:

Code:
dropbear
To check if it is running, type:

Code:
ps
and to make sure it is listening, type:

Code:
netstat
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:

Code:
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.

Enjoy!

Credits:
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
Last edited by staulkor; 6th November 2008 at 10:49 AM.
The Following User Says Thank You to staulkor For This Useful Post: [ View ]
5th November 2008, 10:30 PM   |  #2  
Member
Thanks Meter: 1
 
49 posts
Join Date:Joined: Jun 2007
What about public key authentication? Have you tried that?

BTW, awesome news!
Last edited by drak0; 5th November 2008 at 10:33 PM.
5th November 2008, 10:34 PM   |  #3  
OP Senior Member
Flag Phoenix, AZ, USA
Thanks Meter: 29
 
259 posts
Join Date:Joined: Jan 2007
More
No, I have not tried that. Ill give it a shot
6th November 2008, 12:08 AM   |  #4  
Senior Member
Flag Atlanta
Thanks Meter: 0
 
194 posts
Join Date:Joined: Nov 2008
More
running
is it fine to just leave dropbear running? or should we kill it when not in use
6th November 2008, 12:23 AM   |  #5  
OP Senior Member
Flag Phoenix, AZ, USA
Thanks Meter: 29
 
259 posts
Join Date:Joined: Jan 2007
More
I dont know. I think it should be fine, but it may eat some extra battery. We will need to test battery life with it running. My guess is that it probably wont impact the battery life.
6th November 2008, 12:36 AM   |  #6  
Senior Member
Flag Atlanta
Thanks Meter: 0
 
194 posts
Join Date:Joined: Nov 2008
More
k
i'll be sure to keep informed about mine too
6th November 2008, 01:14 AM   |  #7  
humble's Avatar
Senior Member
Thanks Meter: 5
 
199 posts
Join Date:Joined: Dec 2007
More
thanks staulkor, you even followed though with the walk-though. now its time for you to catch some Z's you desserved it.
Last edited by humble; 6th November 2008 at 02:53 AM.
6th November 2008, 03:12 AM   |  #8  
Senior Member
Flag Atlanta
Thanks Meter: 0
 
194 posts
Join Date:Joined: Nov 2008
More
ugh
i'm stumped
6th November 2008, 05:00 AM   |  #9  
Senior Member
Flag Atlanta
Thanks Meter: 0
 
194 posts
Join Date:Joined: Nov 2008
More
what's with all the fish names lol if anyone is trying brute force add a list of fish names hehe. i'm going to have to crash i have tried everything i know how and looked through almost everyfile i could think to look through.
6th November 2008, 05:58 AM   |  #10  
Senior Member
Thanks Meter: 5
 
219 posts
Join Date:Joined: Oct 2007
sry if this is a dumb qustion
can someone explain wat exactly running dropbear on the g1 allows us 2 do? im just a little confused

Post Reply Subscribe to Thread

Tags
g1 sshd ssh root android
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes